简体   繁体   English

GitHub 分支总是落后于 master 一个提交

[英]GitHub branch always one commit behind master

I have a GitHub project with a master branch and a dev branch, when I merged from dev to master, I see that the merge commit seems to cause the dev branch to be considered one commit behind master.我有一个带有master分支和dev分支的 GitHub 项目,当我从 dev 合并到 master 时,我看到合并提交似乎导致 dev 分支被认为master后面的一个提交

Is this something common with such a workflow?这在这样的工作流程中是常见的吗? Or did I do something wrong?还是我做错了什么? I tried merging back from master to dev, but it became worse (one commit behind + one commit in front).我尝试从 master 合并回 dev,但情况变得更糟(后面一个提交 + 前面一个提交)。 Also tried a rebase merge from master to dev but dev stayed one commit behind.还尝试了从 master 到 dev 的 rebase 合并,但 dev 留下了一个提交。

What's the solution to this?解决这个问题的方法是什么?

Thank you谢谢

EDIT with commit history from dev:使用来自 dev 的提交历史进行编辑: 在此处输入图片说明

And master:和主人: 在此处输入图片说明

Updated answer更新答案

Ok, you've proceeded with pull requests, but the overall principle is the same : yes when you merge into master for the first time, your source branch ( develop ) becomes in the process effectively one commit behind, like I described in the first version below.好的,你已经处理了拉取请求,但总体原则是一样的:是的,当你第一次合并到 master 时,你的源分支( develop )在这个过程中实际上变成了一个提交,就像我在第一个中描述的那样下面的版本。 You can be reassured that it's typical in this kind of workflow, and it won't keep you from merging down the line, they're just a fast-forward away.您可以放心,这在此类工作流程中很常见,并且不会阻止您合并,它们只是快速前进。


(Below, first version of the answer, wrongly assuming local merge operations) (下面是答案的第一个版本,错误地假设了本地合并操作)

When you're at the point you describe after the first merge, with master having one more commit, it's the merge commit, as you correctly guessed.当您在第一次合并后描述时, master又有一次提交,这就是合并提交,正如您正确猜测的那样。

At this point all you need to do if you want the two branches to be perfectly synchronized (although at this point they're already similar in terms of files) is to merge master back into develop , it will be a simple fast-forward where develop gets the last commit.此时,如果您希望两个分支完全同步(尽管此时它们在文件方面已经相似),您需要做的就是merge master mergedevelop ,这将是一个简单的快进,其中develop获得最后一次提交。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 分支落后于 'GitHub/master' 1 次提交 - Branch is behind 'GitHub/master' by 1 commit “使用”一个成功的Git分支模型“,在Github中,这个分支是提前1次提交,1次提交后” - “This branch is 1 commit ahead, 1 commit behind master” in Github while using “A successful Git branching model” Git:您的分支是在master后面提交1个,在master后面提交5个? - Git: Your branch is 1 commit ahead and 5 commit behind master? 将 Hotfix 分支合并到两者后,功能分支是 Master 后面的 1 个提交 - Feature branch is 1 commit behind Master after merging Hotfix branch to both Git 孤儿分支“此分支提前 1 次提交,在 master 后面提交 n 次” - Git Orphan branch “This branch is 1 commit ahead, n commits behind master” 分叉分支在主分支后面提交1次时更新 - Forked branch is updated while being 1 commit behind the master branch 我的dev分支是在请求请求后在master后面提交1次 - My dev branch is 1 commit behind master after pull request git 分支在 master 无限循环之前/之后提交 - git branch commit ahead of/behind master infinite loop Github通过x提交显示(开发)分支 - Github showing (develop) branch behind master by x commits 在GitHub上,“该分支前面是0提交,而后面是0的提交”是什么意思? - What does “This branch is 0 commits ahead and 0 commits behind master” mean on GitHub?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM