Post Receive Hook to Update The Checked Out Copy #!/bin/sh cd .. env -i git reset –hard Add a remote Note: There is no : between the host and the path git remote add origin ssh://user@host/path/to/repo/.git Undo the last commit If you want the changes to stay in the working directory but just want to undo the actual commit. git reset –soft HEAD^ If you want to get rid of the last change completely then to.