Brad Lucas

Programming, Clojure and other interests
July 9, 2017

Git Reset Hard

Here is how you can backup one commit in Git. The situation is where you've just committed to a branch and want to backup and throw this recent commit away.

Get the SHA of the previous commit then git reset hard to it.

For example,

$ git reset --hard 2acdd9bcdbd71a4ee919c90c0e964778346c54d1
Tags: git