I wanted to have a simple solution to squash two merge commits together during an interactive rebase.
My repository looks like:
X --- Y ---------
None of the mentioned methods works for me with a recent git version. In my case the following did the trick:
git reset --soft Y git reset --hard $(git commit-tree $(git write-tree) -p HEAD -p stable < commit_msg)
You'll have to write the commit message to the file commit_msg first, though.