有人推了一个分行test
与git push origin test
共享仓库的共享仓库。git branch -r
如何查看遥控器test
我试过了
git checkout test
,它没有做任何事情git checkout origin/test
给给* (no branch)
有人推了一个分行test
与git push origin test
共享仓库的共享仓库。git branch -r
如何查看遥控器test
我试过了
git checkout test
,它没有做任何事情git checkout origin/test
给给* (no branch)
当前回答
使用 :
git checkout -b <BRANCH-NAME> <REMOTE-NAME>/<BRANCH-NAME>
其它答案在我的良性案例中不适用于现代 Git 。 如果远程分支是新的, 您可能需要先拉一下, 但我还没有检查过这个案例 。
其他回答
git branch -r
表示对象名称无效, 因为该分支名称不在 Git 的本地分支列表中。 更新您的本地分支列表来源 :
git remote update
然后再试着检查一下你的远程分支
这对我管用
我相信git fetch
拉拉进全部( 全部)远端树枝,这不是最初的海报所要的。
出于某种原因,我不能做:
git checkout -b branch-name origin/branch-name
它在抛出错误:
致命 : “ 来源/ 分支名称” 不是一个承诺, 无法从中创建分支“ 分支名称 ” 。
我必须这样做:
git checkout -b branch-name commit-sha
我被困在一个状况中看到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 fetch --all
将所有远程分支都带回您的本地
git checkout test
将您切换到测试分支
在这种情况下,你可能想要 创建本地test
正在跟踪远程test
分支 :
$ git branch test origin/test
先前版本的git
,你需要一个明确的--track
选项,但当您正在从一个远程分支进行分支分割时,这是默认值。
创建本地分支和切换到它,使用:
$ git checkout -b test origin/test