The typical question is how to remove the latest commit. This is easy: git reset --hard HEAD~1
But ... I don't want the working directory to be overwritten with the new head contents.
If you reset the head, the working directory is restored to the contents of the repo as of that head commit. I want to keep my changed files.
E.g. I have changed three files, but want to commit only two. I accidentally commit all three. If I reset the head, not only is the bad commit removed, but all of the changed files are reverted. I want to remove the latest commit, then commit just the two I intended to commit. This means that I need to keep the changed files in the working directory.
I think I've explained the issue well enough. Or at least I hope so.