【问题标题】:How do I checkout a remote branch?如何签出远程分支?
【发布时间】:2016-06-08 17:40:19
【问题描述】:

当我git branch 时,我只看到'master'、'v2/branch1' 和'v2/master',但是当我git branch -r 时,我看到更多的分支出现在 origin 之后。如果我想在这些远程分支之一工作,我只是 git checkout 吗?这会自动将我的工作目录和索引更改为该分支并为我设置跟踪分支吗?

【问题讨论】:

标签: git git-branch git-checkout


【解决方案1】:

git fetch remote

git checkout --track -b local_branch_name origin/branch_name

【讨论】:

  • 你能解释一下抓取的目的吗?我的 git branch -r 不是意味着我已经在跟踪所有这些远程分支了吗?
【解决方案2】:

按照以下步骤操作:

git branch -r
git checkout <branch name>

【讨论】:

    猜你喜欢
    • 2010-12-19
    • 1970-01-01
    • 1970-01-01
    • 2015-09-26
    • 1970-01-01
    • 1970-01-01
    • 2017-03-08
    相关资源
    最近更新 更多