在恢复的合并中查找提交 [英] Find commits in a reverted merge
问题描述
我做了一个未完成的分支与主人合并。我做了一次还原合并以反转代码更改。
现在问题是我无法再将此特定分支再次合并到master。所以我打算现在要做的是创建一个新的虚拟分支,然后樱桃选择丢失的提交并将其放入新分支,并将上述分支合并到新创建的分支,并从新创建的分支恢复开发。这会工作。
我的问题是在git中实现相同的方法吗?
我不想要回复回复。
谢谢 解决方案
樱桃挑选,你应该做的,有一个棘手的方法让git认为分支仍然没有合并 - 用相同的非合并提交替换合并提交。
git replace --edit< merge commit>
在编辑器中打开文本,如
树AAAAA
父BBBB
父CCCCC
作者...
然后删除第二个父行(带CCCC),保存退出。现在合并提交将被视为git作为简单的提交,并且分支可以再次合并。
替换可以在第二次合并后被移除。
I did a merge of a unfinished branch to master. I did a revert merge to reverse the code changes.
Now the problem is I cannot merge this particular branch again to master. So what I plan to do now is to create a new dummy branch and cherry pick the lost commits and put it in the new branch and merge the above branch to the newly created branch and resume development from the newly created branch. This would work.
My question is is there a neat way of achieving the same in git?
I don't want to do a revert of revert.
Thanks
Except the cherry-picking, which you probably should do, there is a tricky way to make git think the branch still not merged - replace the merge commit with identical non-merge commit.
git replace --edit <merge commit>
In the editor open the will be text like
tree AAAAA
parent BBBB
parent CCCCC
author ...
Then remove the second "parent " line (with CCCC), save, exit. Now the merge commit will be seen to git as simple commit, and the branch can be merged again.
The replacement can be removed after second merge.
这篇关于在恢复的合并中查找提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!