First revert the full commit (puts it in index) but don't commit, where -n
is short for --no-commit
:
git revert -n <sha1 to reverse>
Then interactively remove ("destage") the reverted GOOD changes from the index, where -p
is short for --patch
:
git reset -p
Then commit reverse diff of the bad changes:
git commit -m "Partially revert <sha1>..."
Finally the reverted GOOD changes (which have been unstaged by the reset command) are still in the working tree. They need to be cleaned up. If no other uncommitted changes are left in the working tree, this can be done by:
git reset --hard