I’m using something like this on my production server, setup as a post-receive hook on github, and it’s basically set to pull changes on a specific branch whenever it gets a properly formatted request from github.
Now, let’s say someone pushed bad code to master, which automatically pulled on production and broke everything. What is the best way to revert the changes, without having to ssh to the production server and manually checkout old code? Ideally it would be as simple as doing another push.
Thanks!
If that bad code is the result of one or several commits, use
git revertto cancel them locally.That will create a new commit cancelling the bad code, and you can push that commit.
Pushing that revert commit to GitHub will trigger the post-receive hook and pull that new change into production.