I’m in the middle of building a new piece of functionality for a client-site. My local development copy is a mess of half finished, broken and untested pages. But the client has just spotted a bug on the live site.
I can’t very well fix it in my current copy and push it live as it will push all my work in progress stuff as well. But before I started on this new functionality I created a new branch. This means that I can simply do ‘git checkout master’, which will put the project back to the same state as is live. Then I can fix the bug and push my changes live before doing ‘git checkout foobar’ to return to the code I was working on.
No muss, no fuss. And no fucking about trying to revert changes or taking new copies of the production site, etc, etc.