[英]How to checkout remote branch git?
Me and my team member are working on same repository. 我和我的团队成员正在使用相同的存储库。 Someone create a branch from master called test_01, worked on that and commit, push to test_01 and merge to master.
有人从master创建一个名为test_01的分支,处理并提交,推送到test_01并合并到master。 In the meantime some commit are done in master.
与此同时,一些提交是在master中完成的。 Now I want to checkout that test_01 so that I write
现在我想检查那个test_01,以便我写
git checkout test_01
and got a git error : pathspec 'test_01' did not match any file know to git . 并得到一个git错误:pathspec'test_01'与任何知道git的文件都不匹配。
After a git fetch, check the list of the remote tracking branches with: 获取git后,检查远程跟踪分支列表:
git branch -avv
If you see origin/test_01
, a git checkout test_01
should work, since it is the equivalent of: 如果你看到
origin/test_01
, git checkout test_01
应该可以工作,因为它相当于:
git checkout -b <branch> --track <remote>/<branch>
But since it does not work, it is likely the test_01
branch was merged to master
locally by the other developer, and only master was pushed. 但由于它不起作用,很可能
test_01
分支由其他开发人员在本地合并到master
,并且只推送了master。
You can try and look for the commit of that unnamed branch merged into master: see " Find merge commit which include a specific commit ". 您可以尝试查找合并到master中的未命名分支的提交:请参阅“ 查找包含特定提交的合并提交 ”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.