How can I switch to another branch in git?

后端 未结 9 673
难免孤独
难免孤独 2021-01-29 17:38

Which one of these lines is correct?

git checkout \'another_branch\'

Or

git checkout origin \'another_branch\'
         


        
9条回答
  •  庸人自扰
    2021-01-29 18:34

    If you want the branch to track the remote branch, which is very important if you're going to commit changes to the branch and pull changes etc, you need to add a -t for the actual checkout like so: git checkout -t branchname

提交回复
热议问题