我有一个带有另一个遥控器的存储库upstream
除了origin
。我可以git checkout origin/master
,但是当我跑步时git checkout upstream/master
, I get:
error: pathspec 'upstream/master' did not match any file(s) known to git.
这也不起作用:
$ git fetch upstream
From https://github.com/getsentry/sentry
* branch HEAD -> FETCH_HEAD
$ git co -b asdf --track upstream/master
fatal: Cannot update paths and switch to branch 'asdf' at the same time.
Did you intend to checkout 'upstream/master' which can not be resolved as commit?
如何查看分支机构upstream
像我一样远程origin
偏僻的?我的git版本是2.1.2。
只需从远程获取引用(这将获取上游存储库的所有分支、提交、引用等)
git fetch upstream
之后,签出所需的分支(这将创建分支的本地副本)
git checkout -b <branchname> --track upstream/<branchname>
现在,如果您想将来拉取此分支中的更改,您需要做的就是
git pull upstream <branchname>
如上所述here https://stackoverflow.com/a/1614996/1860929,尝试对分支名称进行显式获取:
git fetch upstream master:branch_name
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)