July 2018
Beginner
552 pages
13h 18m
English
Resetting a working copy is something that should not be done lightly. It will reset your HEAD pointer, which keeps track of the commit your repository is currently at. By default, your working tree is preserved, so all unstaged changes are kept as they are, and the HEAD pointer is reset to a specific commit. This means that you can commit your changes on top of the commit that you reset to, while all other commits will be discarded:
# Reset the repository to the commit before our changesgit loggit reset 23e16ac822dab6f7674608b58fe46a7b9bf038b8 --hard# Git log now only shows commits up until the commit you reset HEAD togit log
A hard reset will also reset your working tree, in addition to resetting your HEAD pointer. A soft reset will ...
Read now
Unlock full access