The GitHub Blog runs a very handy post: How to undo (almost) anything with Git, which covers a variety of git scenarios which you’d want to undo – anything from typos in commit messages to handling of branches.
If you don’t feel like learning all that, have a look at gitjk (as in “just kidding”) tool that I linked to before.