The best solution without hacking in the .git directory is to use erase and reset.
>git merge --no-commit $otherbranch >git stash >git reset HEAD >git stash pop >git commit -a
It should be trivial to automate if you need it more often.
Please note that this seems to work without the code part at a glance, but it fails to add files, so unnecessary passage through the cache cannot be omitted.
Likao
source share