git pull 之后我得到这个输出。
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> my_branch
问题是我已经创建了该分支,并在该分支上完成了提交,然后切换到其他分支并返回到这个分支。比新用户添加了一些提交,之后我收到了此消息。
我的问题是不是如何解决这个问题,我想知道是什么原因造成的以及如何防止再次发生。
这是因为你没有设置upstream
(这意味着您要跟踪哪个远程分支)。
设置跟踪远程分支:
如果本地分支是在本地计算机中创建的,那么当您推送到远程时,您可以使用-u
/--set-upstream
当你这样做时的选项git push
.
如果从远程分支检出分支,那么您可以使用--track
当你这样做时的选项git checkout
.
要解决这个问题(设置远程跟踪分支),只需执行 git 告诉你的操作:
git branch --set-upstream-to=origin/<branch> my_branch
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)