1

I read 'http://gitready.com/intermediate/2009/02/13/list-remote-branches.html' . I am using git 1.6.3.3. My question is how can I check out a local branch which track a remote branch 'origin/2-2-stable'? In other words, when I push, I will push to 'origin/2-2-stable' instead of 'master'?

$ git branch * master $ git branch -a * master origin/1-2-stable origin/2-0-stable origin/2-1-stable origin/2-2-stable origin/3-0-unstable origin/HEAD origin/master $ git branch -r origin/1-2-stable origin/2-0-stable origin/2-1-stable origin/2-2-stable origin/3-0-unstable origin/HEAD origin/master 

1 Answer 1

1

The quick way to do this would be git checkout 2-2-stable.

This creates a local branch 2-2-stable which tracks the remote branch origin/2-2-stable, and checks out this branch.

The long way would be to use git branch 2-2-stable origin/2-2-stable (and doing the checkout separately). If origin/2-2-stable is not a remote branch, you would have to give the -t option to git branch.

Sign up to request clarification or add additional context in comments.

2 Comments

How can I double check if my branch is tracking the remote branch correctly? I have done 'git branch -a', it does not show which remote branch I am tracking.
Look at git config -l, it should show it in the branch.* keys.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.