我有一个跟踪非默认分支的代码库。因此,有一个名为“master”的本地分支应该跟踪“origin/master-13.07”。我已经执行了“push -u”,并且相信这应该足够了,该分支已被跟踪。运行git branch -vv
的输出:
C:\work\repo>git branch -vv
stuff 68792df [origin/stuff-13.07] Small bugfix
* master 68792df [origin/master-13.07: ahead 1] Small bugfix
git status
的输出结果。
C:\work\repo>git status
# On branch master
# Your branch is ahead of 'origin/master-13.07' by 1 commit.
# (use "git push" to publish your local commits)
#
nothing to commit, working directory clean
看起来一切都很顺利,但当我只使用 "git push"(如上面git建议我的方式)时,它失败了:
C:\work\repo>git push
fatal: The upstream branch of your current branch does not match
the name of your current branch. To push to the upstream branch
on the remote, use
git push origin HEAD:master-13.07
To push to the branch of the same name on the remote, use
git push origin master
是的,我知道名称不匹配,这正是我想要的,并且我通过“push -u”告诉了git。为什么我不能只使用“push”?
C:\work\repo>git --version
git version 1.8.3.msysgit.0
C:\work\repo>git config push.default
simple
push.default
选项吗? - Guillaume Darmontpush.default
更改为upstream
。谢谢。 - kan