Basic rules for software deployment

Every now and then someone asks me what is the best way to deploy code to a server. There’s a lot to be said about this subject, so I usually end up disappointing the inquirer because I rarely have a simple answer for them. Like so many other things in life, the best way to do it really depends on the exact situation - the scale you’re operating at, the type of servers you use, the type of application you’re deploying, the level of security required, the infrastructure being used, etc. »

How to undo a git push --force and undelete things

Today someone asked for my help to undo a git push --force that messed up his production server by overwriting the master branch with something that wasn’t meant to be there. My first advice would be to not deploy to production servers by manually running git pull or git push, but that’s another story. ;) So how would you solve the situation? It’s actually quite simple but if you don’t know some details about how git works, it can seem a bit daunting. »