I know how to swap the last two commits using git rebase interactively (git rebase -i HEAD~2, ddjp:x in Vim), but I\'d like to do it p
git rebase
git rebase -i HEAD~2
ddjp:x
This should do it:
git tag old git reset --hard HEAD~2 git cherry-pick old git cherry-pick old~1 git tag -d old
First, you tag the place where you are as old, then go back two commits, git cherry-pick the commits in the other order, and delete the old tag.
old
git cherry-pick