Checkout remote Git branch

来源:互联网 发布:美国近期非农数据预测 编辑:程序博客网 时间:2024/05/16 17:24

http://stackoverflow.com/questions/1783405/checkout-remote-git-branch

With Git versions ≥ 1.6.6, you can just do:

git fetchgit checkout test

Old Answer

Before you can start working locally on a remote branch, you need to fetch it as called out in answers below.

To fetch a branch, you simply need to:

git fetch origin

This will fetch all of the remote branches for you. You can see the branches available for checkout with:

git branch -v -a

With the remote branches in hand, you now need to check out the branch you are interested in, giving you a local working copy:

git checkout -b test origin/test

0 0
原创粉丝点击