git reset --hard HEAD^
Which means reset git to one commit before the current head, effectively getting rid of the last commit.
Also, to undo a merge into master, you can reset back to origin/master with:
git reset --hard origin/master
More scenarios for undoing merges on this stackoverflow page.