How it works...

The reset command works as explained in the previous examples but, combined with the stash command, it forms a very useful tool that corrects mistakes even though you have already starting working on something else. The stash command works by saving the current state of your working directory and the staging area. Then, it reverts your working directory to a clean state.

Get Git Version Control Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.