Rob Lacey

Brighton, UK -

Senior Software Engineer working since 2008 with Ruby / Ruby on Rails, love a bit of Elixir / Phoenix and learning Rust. I also poke through other people's code and make PRs for OpenSource Ruby projects that sometimes make it. Currently looking for new opportunities

The scariest day of my life. Tainted master branch

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
 + <someotherhash>...<somehash> <somehash> -> master (forced update)

There were tears of joy and shaky hands, but it was fine.