Also, if you don't want to use "git reflog" at all for "undoing", you could undo your previous commit with:
git reset HEAD^
Or if you also want to discard the changes you made to files in the repo at the same time: git reset HEAD^ --hard
But use the --hard option wisely. Be sure you really don't want to keep any of the changes you made (or that you have already saved them elsewhere before running it).