More and more server-side file deployments are handled using git. It's nice and there are plenty of guides available how to setup your deployment workflow with git, rsync and others.
However, I'd like to ask what's the cleanest way to set deployment rollbacks, so that
Every time you deploy, you record the latest state before the deployment (no need to manually read through logs to find the commit)
What git commands use to rollback to the prior (recorded) state in the case deployment has unforeseen consequences
The scope of the question is Linux servers, shell scripting and command line git.