【问题标题】:Git branch is always aheadGit 分支永远领先
【发布时间】:2018-11-28 09:58:00
【问题描述】:

我有一个主分支和一个开发分支。 我目前在我的开发分支中。

当我做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

To push to the branch of the same name on the remote, use
git push origin development

所以我输入git push origin development 推送到开发分支。但我只是想输入git push 来推送到当前分支(开发)。

当我输入 git status 时,我会收到以下消息:

Your branch is ahead of 'origin/master' by 26 commits.

所以我做了一个从开发到主分支的拉取请求,并将开发分支合并到主分支。但我仍然收到消息“您的分支领先于...”。

我在这里做错了什么?

谢谢

【问题讨论】:

    标签: git bitbucket git-branch


    【解决方案1】:

    当您创建开发分支时,您以某种方式将其设置为跟踪 origin/master 而不是 origin/development

    运行 git branch -vv 以查看您的分支以及它们正在跟踪的上游分支。

    您可以通过以下方式更正开发分支的上游设置:

    git branch --set-upstream-to=origin/development development
    

    【讨论】:

    猜你喜欢
    • 2011-01-23
    • 2014-05-08
    • 2011-01-26
    • 1970-01-01
    • 2012-04-27
    • 2012-10-22
    • 2011-01-21
    相关资源
    最近更新 更多