Suppose I have some commits:
<sha1> bug due to function1
<sha2> bug due to function2
... other commits
and I would like to squash commits 1 and 2 together, keeping only the message of the second commit, then I would use git rebase -i
, edit to:
pick <sha1> bug due to function1
squash <sha2> bug due to function2
... other commits
And I would always need to edit the combined messages and delete the first one.
I know I could rearrange the commits and use fixup
like this:
pick <sha2> bug due to function2
fixup <sha1> bug due to function1
pick <sha3> other commit
but then I have the risk that, reversing the order of the two commits, there might be some conflicts.
How could I achieve the same result with less manipulations, especially avoiding the editing of the combined message. Note that there might be many commits before commit 1 and after commit 2.