Skip to main content



      Home
Home » Eclipse Projects » EGit / JGit » Why my remote branches are not checked out locally??
Why my remote branches are not checked out locally?? [message #1150737] Tue, 22 October 2013 20:19 Go to next message
Eclipse UserFriend
Hi,

I am new to Git and EGit.

I have a new private repository cloned it out and added Eclipse project to it then commit and pushed everything to the master branch.

Now I have deleted the repository from Eclipse. Then added the extra branchs from the website itself as follows:

master [main branch]
branch001
branch002
branch003

I did re-clone my repository by pasting the repository link then I selected all branches then I selected master as my initial branch and configured remote name to be origin (the default options) I also checked import all existing project because I have added a project in previous steps. Then I clicked finish.

Now my repository look like this:
In the [Branches] tree there are two subtrees:
--Branches
----Local:
------master
----Remote Tracking
------origin/master
------origin/branch001
------origin/branch002
------origin/branch003


Why I am not having my branches in my local repository?
How can I bring them to the local repository?

Edit:
I noticed that I can checkout and work with master from Local and master from Remote Tracking, what are the differences?

I also noticed that I can checkout branches from Remote Tracking. Is it OK to work with checking these branches from Remote Tracking tree?

Thank you,
Mohammad

[Updated on: Tue, 22 October 2013 20:21] by Moderator

Re: Why my remote branches are not checked out locally?? [message #1152111 is a reply to message #1150737] Wed, 23 October 2013 16:36 Go to previous message
Eclipse UserFriend
git has 2 types of branches:

local branch:
- used to create new commits in the local repository
- the currently checked out local branch will move when you create a new commit

remote tracking branch:
- proxy for the respective branch of the corresponding remote,
e.g. remotes/origin/master proxies the master branch in remote origin
- remote tracking branch is moving when you fetch new commits from the remote,
when the branch in the remote moved since new commits arrived in that branch
fetch will bring them to your local repository and move the corresponding remote
tracking branch so that it reflects the state of the branch in the remote

This means if you want to create new commits in your local repository you need to
create and checkout a local branch based on the remote tracking branch you want
to push the new commit to.

You can also checkout a remote tracking branch e.g. to test that version, but it
will not move when you create a new commit since remote tracking branches
only move when fetch brings new commits from the remote repository.
Previous Topic:JGit on DFS?
Next Topic:Installing EGit from Eclipse Marketplace
Goto Forum:
  


Current Time: Mon Jun 30 18:00:25 EDT 2025

Powered by FUDForum. Page generated in 0.03203 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top