Find your amended commits by:
git log --reflog
Note: You may add --patch
to see the body of the commits for clarity. Same as git reflog
.
then reset your HEAD to any previous commit at the point it was fine by:
git reset SHA1 --hard
Note: Replace SHA1 with your real commit hash. Also note that this command will lose any uncommitted changes, so you may stash them before. Alternatively, use --soft
instead to retain the latest changes and then commit them.
Then cherry-pick the other commit that you need on top of it:
git cherry-pick SHA1