When I git branch I only see 'master', 'v2/branch1', and 'v2/master', but when I git branch -r I see a lot more branches that come after origin. If I were to want to work in one of these remote branches, do I just git checkout ? Would that automatically change my working directory and index to that branch and set up the tracking branch for me?
Asked
Active
Viewed 64 times
-1
love
- 1,000
- 2
- 16
- 35
akantoword
- 2,824
- 8
- 26
- 43
-
6Possible duplicate of [Checkout remote Git branch](http://stackoverflow.com/questions/1783405/checkout-remote-git-branch) – Vitor Jun 08 '16 at 17:43
2 Answers
0
git fetch remote
git checkout --track -b local_branch_name origin/branch_name
Shravan40
- 8,922
- 6
- 28
- 48
-
can you explain the purpose of fetching? Doesn't my git branch -r mean that I'm already tracking all of these remote branches? – akantoword Jun 08 '16 at 17:53