这里是事情的关键:
$ git checkout -b new-branch
Switched to a new branch 'new-branch'
$ git push
...
* [new branch] new-branch -> new-branch
$ git pull
There is no tracking information for the current branch.
Please specify which branch you want to rebase against.
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> new-branch
我看到过其他问题,答案建议在第一次推送时执行git push -u
。但是我总是忘记这样做。
是否有配置选项可以在从我的仓库推送新分支到远程仓库时自动设置上游跟踪分支?
--set-upstream-to
来修复问题,就像Git错误信息中所示。但是,如果至少该消息已准备好被复制/粘贴就好了。但我必须手动替换<branch>
。 - warvariuc[new branch]
并执行--set-upstream-to
呢?这样可以解决竞争条件并且速度更快,只需要第一次执行即可。 - warvariuc--progress
强制执行); 并且(c)它仅是实现的副作用; 它是国际化的(因此您必须覆盖$LANG
); 它过去已经更改了格式,所以将来可能会再次更改格式。换句话说,它并不是非常可靠的。 - torek