You wake in a dark room and someone has only gone and tainted your master branch by merging in multiple commits spanning weeks of work. We can’t possibly unpick 100+ commits, what the hell even were they? But we need master back as it was.
We can however, reset our master to a particular commit in the past that we trust.
git checkout master git reset --hard <somehash> git push --force origin <somehash>:master Total 0 (delta 0), reused 0 (delta 0), pack-reused 0 To github.com:somerepo/someproject.git + <someotherhash>...<somehash> <somehash> -> master (forced update)
There were tears of joy and shaky hands, but it was fine.