Undoing

Marie-Hélène Burle

training@westgrid.ca

Reverting

Git revert cancels out the changes of a commit by adding another commit with the reverse patch

This is safe since you are not touching at the history: you are only adding to it

Resetting

Git reset is a subtle command with lots of usage

With the --hard flag, it allows to undo some work by getting rid of some commits altogether. Unlike most other commands in Git, this actually rewrites the history of your project

Needless to say that this is something that you only want to consider once you are starting to feel really comfortable with Git as it implies loss of data and irreversible actions

Questions?