I have a workspace that points to an SVN repository(Eclipse Mars).
The code under this repository has been migrated to git.
How can I point to this new git repository without breaking my current workspace?
What I would do is:
Close eclipse.
Save the whole directory on a zip, just in case.
Save all your local change from the revisiĆ³n you are working on. What I would call stash your changes in git terms
inside the directory of the project, run : git init .
Set a remote to the svn clone you made on git
run git fetch --all
Find on git the exact same revision you are working on svn
Run git checkout --force the-revision-id
At this point, you could delete .svn because you are already switched to git. When starting eclipse, it should just show stuff as if you are working on git, no svn.
Related
I've GitHub repository in my IIB10 toolkit using EGit plugin.
I used to work with that repository.
I took workspace project interchange(PI) backup, later some changes my project has crashed.
So, I just imported my project from the PI backup and it got disconnected from GitHub.
I am using the same project in the different workspace, there also this project has deleted.
Now I have that project in the local workspace(not local git). How can I resolve this one? Please help me out.
If your workspace has no .git subfolder, you should at least:
clone your original GitHub repository
import your restored backup back to the new local clone
That is:
cd /path/to/restored/repo
cd ..
git clone https://github.com/<me>/<myrepo>
cd myrepo
git --work-tree=../repo add .
git commit -m "import from backup"
git push
How to import a specific project from github ? I dont want to clone the entire repository
I just want to clone only a portion of repository .
For eg this url https://github.com/eugenp/tutorials
has many projects but I just want to clone only spring-boot-crud project .
Here is the url for spring-boot-crud project.
https://github.com/eugenp/tutorials/tree/master/spring-boot-modules/spring-boot-crud
Thank you .
You can look into a git sparse-checkout: that command is made to checkout only part of a Git repository. This assume the latest Git 2.26 though.
And I mean Git-core, as in Git SCM, not Egit (which does not support the new sparse-checkout command)
Even though the command is new and still experimental, it should be useful in your case.
git clone --no-checkout /url/a/repo
cd repo
git sparse-checkout init --cone
git sparse-checkout set spring-boot-modules/spring-boot-crud
Then open the relevant project in your Eclipse.
Create a project in the Git repo (.project, in the root folder of your repo)
That will give you:
git clone -n https://github/git/git git2
cd git2
git sparse-checkout init
git sparse-checkout set Documentation
At this point, you have the repository git/git with only the folder Documentation checked out (everything else is not in the working tree)
# create an empty project in C:\path\to\git2 in Eclipse
As you can see, all the other files not checked out are not displayed in the Git staging view. Only the ones currently checked out and modified are listed.
The first step must be done in command-line because JGit does not support the sparse-checkout directive (see but 383772 and change 33)
I have a problem with my project in Eclipse IDE.
For the first time, I worked on an old version and made several changes.
I tried to upload the project on GitLab for the first time I configured Git on Eclipse IDE and I tried to commit and push "but I could do that only after doing a 'Fetch' from the remote branch and commit the 'Merge' change in my local repository.
Because I got this error:
rejected non-fast-forward
I followed this link Egit rejected non-fast-forward to fix it.
The fetch downloaded all the git project files in my project on Eclipse. Until now in my project, I have a subfolder like this: myProject/myProject.
I made several commits and push and it works normally. I figured out that a subdirectory in gitLab docroot is created with every push I make.
This is the local project structure:
This is the project structure on GitLab:
I want to delete docroot/WEB-INF/classes from GitLab.
How to delete this commit from GitLab using git plugin in Eclipse and how to correct my local project structure?
docroot/WEB-INF/classes is a folder. Git does not track folders, only files:
To delete a folder, you have to delete all the files in it.
In the Git Staging view, commit the deletions.
Make sure your current local branch is configured as When pulling: Rebase (in the Git Repositories view right-click the branch and choose Configure Branch...)
Git > Pull to make sure your commit is the latest commit in the upstream branch. If there are conflicts, you have to resolve them in the Git Staging view
Git > Push to Upstream
For details see the EGit User Guide and be aware that old Stack Overflow answers refer to outdated version of EGit.
I have a spring application in ClearCase repo currently with 3 folders architecture such as util, web and EAR but I need to migrate it to Git.
So how this architecture to be maintained with gradle, as I don't want to change my code
If your current working tree is working with graddle, simply import it in a new git repo from your snapshot view:
cd /path/to/snapshot/view
git init .
touch .gitignore
Add the files/folder you don't need in a git repo.
See for instance Gradle.gitignore
git add .
git commit -m "My first commit"
That won't import the full history (you still can see it through ClearCase), but you will then be able to push that git repo to a remote one, and start working with Git from there.
I backed up a copy of an Eclipse project to disc, because my hard drive needed to be wiped. I did not push my changes to git, though.
I am currently using an alternate computer to code the project. I would like to now push the changed files to git. How can I sync this project to the git server without overriding changes, and then push the changed files?
If your backup included the .git directory, then you can sync the project the same way you would have done on the original computer. That is, you can do a git pull followed by a git push.
Additionally, if you have local changes that were not commited, you can add a git stash before pulling and conflict resolution.
git stash
git pull
git stash pop
# Resolve any conflicts
git push