Git分支永远领先

时间:2018-11-28 09:58:01

标签: git bitbucket git-branch

我有一个master分支和一个development分支。 我目前在开发部门。

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

因此,我从开发人员发出了一个拉取请求,以掌握并将开发分支合并到master分支中。但是我仍然收到消息“您的分支位于...之前”。

我在这儿做错什么了?

谢谢

1 个答案:

答案 0 :(得分:1)

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

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

您可以使用以下方法更正开发分支的上游设置:

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