有人推了一个分行testgit push origin test共享仓库的共享仓库。git branch -r如何查看遥控器test我试过了

  • git checkout test,它没有做任何事情
  • git checkout origin/test给给* (no branch)

当前回答

运行这两个命令,你应该可以去。

git checkout <branch-name>
git pull <remote> <branch-name>

其他回答

你可以试试

git fetch remote
git checkout --track -b local_branch_name origin/branch_name

git fetch
git checkout -b local_branch_name origin/branch_name

在这种情况下,你可能想要 创建本地test正在跟踪远程test分支 :

$ git branch test origin/test

先前版本的git,你需要一个明确的--track选项,但当您正在从一个远程分支进行分支分割时,这是默认值。

创建本地分支切换到它,使用:

$ git checkout -b test origin/test

我被困在一个状况中看到error: pathspec 'desired-branch' did not match any file(s) known to git.以上所有建议。我正在讨论Git 1.8.3.1版本。

所以这个为我工作:

git fetch origin desired-branch
git checkout -b desired-branch FETCH_HEAD

背后的解释是,我注意到 当我拿起遥控树枝时,时前:

git fetch origin desired-branch

From github.com:MYTEAM/my-repo
    * branch            desired-branch -> FETCH_HEAD

在我看来,没有人建议 最简单的方法(也许我太笨了 觉得这太蠢了)"一种方式"但无论如何,试试这个:

git pull origin remoteBranchName
git switch remoteBranchName

这对我也有效(在我最后一次拉拉请求后,在遥控器上创建了一个分支)。

运行这两个命令,你应该可以去。

git checkout <branch-name>
git pull <remote> <branch-name>