我想清理一个开发分支。有一个分支由多个提交创建,包括将开发分支合并回功能分支。然后功能分支合并到开发中。壁球n提交到一个,当n包括合并
所以在发展,我有一些提交:
"Some commit"
"More commit"
"merge branch development into feature1"
"Another commit - start of feature work"
"First commit that does not include feature1"
我想粉碎前4个提交到一个承诺。但不管我尝试的东西因为合并而被搞砸了。由于在开发分支上执行的合并工作被粉碎成feature1提交。
是否粉碎了这些提交可能?
编辑,使用重订如下尝试:
当我尝试 'git的变基-i HEAD〜4' 我得到如下:
pick 3e217ba Another commit - start of feature work
pick b44463a merge branch development into feature1
pick 625ba76 More commit
pick 996b98e Some commit
我可以改变,要
pick 3e217ba Another commit - start of feature work
squash b44463a merge branch development into feature1
squash 625ba76 More commit
squash 996b98e Some commit
但是,这个问题是我压扁提交'squash b44463a合并分支开发到feature1',我不想这样做。因为该合并包含合并到feature1分支的开发分支中的工作。我想让这个提交看起来像只是feature1的东西。
如果我在重新绑定时删除合并行,它将失败。
你尝试过git squash吗? – CodeWizard
@codeWizard我有。我认为我遇到的问题是,在合并中挤压不属于特征的提交。这是因为合并将开发分支更改拉到feature1分支。 – lostintranslation
尝试按照答案,看看它的工作, – CodeWizard