First note that there is a difference between ‘revert’ and ‘reset’
- ‘reset’ is quite dangerous
 Undoing a ‘git add’ before doing a ‘git commit’
Note: For this scenario, most of the above links are recommending doing a ‘git reset’. There is a difference between a ‘soft’ reset and a ‘hard’ reset.
- This is a very interesting read and helped me clarify a lot of concepts!
 Recently I had to undo a commit I had made into my local git repo. I was under the impression that reverting commits in Git is a big hassle. To my surprise, it didn’t prove to be too much of a pain. These are things I had to do basically:
couple of git reset --soft HEAD~ commands (because there was stuff I had pulled into my repo after commiting)
- couple of git checkout — <file> commands to undo my inadvertent changes.
That was it! I got my repo back to sanity.
 Another import task is to view unpushed git commits. this is an important thing to do, especially before making commits into a remote branch.