如何每次都停止获取额外的合并提交 [英] How to stop getting extra merge commit every time

查看:74
本文介绍了如何每次都停止获取额外的合并提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目,我是唯一的开发人员,具有开发和主分支.每次我将开发合并为master时,我都会得到一个额外的合并提交.我认为这是因为出于某种原因它没有进行FF合并.但是,develop和master分支中的代码是相同的.我将添加一个新功能来开发分支,通常是一次提交,然后在测试后将其合并到master.每次我得到这些额外的提交时(这也使开发分支看起来像master后面的15个提交).

I have a project where I am the only developer, with develop and master branches. Every time I merge develop into master, I'm getting an extra merge commit. I think this is because it is not doing a FF merge for some reason. But the code in the develop and master branches is identical. I'll add a new feature to develop branch, often one commit, then after testing merge it to master. And every time I'm getting these extra commits (which also makes develop branch look like it's 15 commits behind master).

我还有其他一些项目正在以相同的方式运行,但是我并没有获得更多的承诺.因此,看来我已经对该项目做了一些事情,以使它每次都创建这些额外的合并提交.知道如何停止获取这些额外的提交吗?除了炸掉develop分支并从当前的master再次创建之外,我已经做了所有事情.

I have a few other projects I'm running the same way, and I'm not getting the extra commits on those. So it appears I've done something to this project to cause it to create these extra merge commits every time. Any idea how to stop getting these extra commits? I've done everything except blow away the develop branch and create it again from current master.

奖金问题,是否可以通过本质上删除合并提交而不挤压或删除伴随它们的其他提交来清理历史记录?我曾经考虑过吹掉MASTER分支,然后再通过development重新创建它(因为它没有多余的提交),但是我不确定那是个好主意.

Bonus question, is it possible to clean up the history by essentially removing the merge commits without squashing or removing the additional commits accompanying them? I've considered blowing away the MASTER branch and creating it again from develop (since it doesn't have the extra commits) but I'm not sure that's a good idea.

推荐答案

如果develop是基于master的,则只能将master快速转发到develop(通过从提交develop指向它,应该可以到达提交master指向).

You can only fast-forward master to develop if develop is "based" on master (by going back from the commit develop points to it should be possible to reach the commit master points to).

看图片,当前master指向28b73893的可能性很大,但develop仍然位于aeb743f1的位置.如果您在develop中进行提交,则无法进行快进.

Looking at the picture, it is very likely that at the moment master points to 28b73893 but develop is still at aeb743f1. If you make a commit in develop, the fast-forward will not be possible.

要解决此问题,请将master合并回develop..这将是一种快速转发的合并.之后,masterdevelop将指向同一提交;并且可以在一个分支中进行提交,而在另一分支中进行快速转发.

To solve that, merge master back to develop. This will be a fast-forwarding merge. After that, master and develop will point to the same commit; and it will be possible to make a commit in one branch and fast-forward the other branch.

这篇关于如何每次都停止获取额外的合并提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆