Recovering from Mistakes

In this chapter, we will cover the following recipes:

  • Undo – Remove a commit completely
  • Undo Remove a commit and retain changes to files
  • Undo Remove a commit and retain changes in the staging area
  • Undo Working with a dirty area
  • Redo – Recreate the latest commit with new changes
  • Revert – Undo the changes introduced by a commit
  • Reverting a merge
  • Viewing past Git actions with git reflog
  • Finding lost changes with git fsck

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.