[英]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谢谢
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 merge
回develop
,这将是一个简单的快进,其中develop
获得最后一次提交。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.