How to download/clone a new branch from my server git repository into an already created local git repository in my PC with Eclipse EGit
I've also been searching around some hours to find out how to get a remote branch in Eclipse EGit...
The solution is stated in this Bugreport. And it is really easy if you know how to do it - no need for using the command line version of git, which - even though it works in 99% of all cases - can be risky as I already had problems that it interfered with Eclipse and EGit.
Just follow these steps:
- First make sure you have opened the EGit
Repository view
. If you haven't opened it already, go to "Window → Show View → Other..." and from there select "Git → Git Repositories". - In the
Repository view
choose "Branches → Remote Tracking". You should see your remote branches there already (example:origin/new_feature
). - Right click on the remote branch you wish to have with your local branches. Choose "Create Branch..."
- The default values should be OK. Normally you should not change anything here. Please note that you should not change the "Pull strategy" to something else than "Merge" if you don't know what you are doing. Otherwise pulling upstream changes might result in a loss of data.
- Click on OK "Finish" and you are done :)
Your fetch is up to date because you already have everything copied to your local repository. A pull will merge origin/development
into master, which isn't what you want. You want to create a new branch with origin/development
as the starting point. I don't know how to do it with egit, but on the command line, you do:
git checkout -b development origin/development
I have been facing the same problem, and here is how I solved it:
Open Git Perspective
First you must have the branch that you want to check out, in your repository under Remote Tracking. My problem was that I couldn't see the remote branch here, so in order to solve this - execute a Pull on the repository, and this command should get you all the branches under Remote Tracking
- right click the (remote) Branch, Check Out, Check out as new local branch