Figured out how to undo merge commits. If you have a branch like so:
develop -A--B--C--D--E
\ \
topic 1--2--M--3
And you wanted to remove the merge, checkout topic
and run git rebase --onto 2 M
, where M is the merge commit and 2 is the topic's commit before the merge commit:
WARNING: THIS DELETES EVIL MERGE CHANGES (changes that do not appear in either parent)
develop -A--B--C--D--E
\
topic 1--2--3'
After than you could then run git rebase develop and you'd get:
develop -A--B--C--D--E
\
topic 1'--2'--3''