I\'ve completely messed up the master branch of my forked git repo.
I want to completely reset the master branch that was pushed to my fork with the contents of the
git reset --hard @{upstream}
or, shorter:
git reset --hard @{u}
Or you can even take it one step further and setup an alias that will allow you to simply type git scrub:
git config --global alias.scrub 'reset --hard @{upstream}'
(This assumes that your branch is configured to track the corresponding remote branch, which it typically is, unless you are doing something special. See git-branch(1) for more details on tracking and git-rev-parse(1) for details on the branch specification syntax.)
And then you just git push --force to your fork, as explained in other answers.