Reset: Recover your mistakes

Posted in GIT by

Git Reset allows you to undo changes made after a commit or between commits.

Undo changes after last commit

git reset --hard HEAD

Afterwards your project will have the state of the last commit. Perfect for doing experiments.

Undo last commit with a new commit

git revert HEAD

You will be able to remove the last edit and create a new fixed one instead. Useful, if you forgot a proper commit message or some files or just a typo.

Published at , Updated at 2011-12-23

prev: working with remotes