Note to self: I quite stupidly merged and committed an unwanted branch into master. Took a surprisingly long time to figure out how to get rid of it:
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.