git tip: replace your master branch with a fresh copy from upstream
Sometimes for whatever reason you screw up and get your local master branch into a nasty inconsistent state. Maybe it was an accidental merge or accidental commits but you just want to start over. Here is how to replace your local master branch with a fresh copy from upstream.
There are easier ways to do this, but conceptually this is, in my opinion, easy to follow and it cleans up your remote as well (if you accidentally pushed a dirty branch).
Written on February 2, 2016