Today I found out that one of my co-workers had a local commit that he wanted to undo, so that he could work on another task that he actually wanted his earlier commit to come after. His question was: How do I undo a commit but keep the files? The answer to that is simple: simply use
git reset HEAD^ to point master to the commit before the current HEAD. By default, this leaves the checked out code alone, and it remains as uncommitted changes locally.
git reset --hard will check out the previous changes and blow your commit away completely.
On the other hand, branches in git are essentially just pointers to nodes in the repository tree. So, consider doing this instead:
git checkout master
git branch new_branch
git reset --hard HEAD^