【发布时间】:2013-06-11 10:38:52
【问题描述】:
我有一个跟踪非默认分支的存储库。因此,有一个名为“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。为什么我不能只使用“推”?
C:\work\repo>git --version
git version 1.8.3.msysgit.0
C:\work\repo>git config push.default
simple
【问题讨论】:
-
你使用哪个 Git 版本?你设置
push.default选项了吗? -
@GuillaumeDarmont 我已将信息添加到问题中
-
@GuillaumeDarmont 似乎解决方案是将
push.default更改为upstream。谢谢。 -
酷。为其他用户添加了更简洁的答案。
标签: git git-branch