Reputation: 387
I'm using git rebase -i --rebase-merges <commit>
to change some commit messages, which works fine. But the merge commits I'd like to preserve had changes or conflict solutions; is there an easy way to redo them?
My current work around is the following:
merge -C <commit>
to merge -c <commit>
to ensure the merge commit is not automatically committedgit checkout <commit> -- .
(-- .
is needed to prevent HEAD being resetted to )Upvotes: 0
Views: 213
Reputation: 488193
There is no Royal Road here: when you've made an evil merge and ask Git to re-perform that merge (with git rebase -r
or similar), Git simply won't make an evil merge.
For this reason, it's sometimes better to make a non-evil merge and follow it up with a fixup commit, even if the non-evil merge is "bad" in some sense (e.g., does not compile or contains a known bug). If you dislike that method, sometimes you can make a commit before making the merge, so that the resulting non-evil merge is good. But this may push the "badness" into that commit (the pre-merge fixup), leaving you with the same bad-tasting setup.
You have your pick of bad solutions: make an evil merge and avoid rebasing it; make an evil merge and put extra effort in when rebasing it; or avoid the evil merge by using fixup commits.
Upvotes: 1