How to undo (almost) anything with Git

Click for: original source

One of the most useful features of any version control system is the ability to “undo” your mistakes. In Git, “undo” can mean many slightly different things. By Joshua Wehner.

When you make a new commit, Git stores a snapshot of your repository at that specific moment in time; later, you can use Git to go back to an earlier version of your project.

The article will give you more info on how to:

  • Undo a “public” change
  • Fix the last commit message
  • Undo “local” changes
  • Reset “local” changes
  • Redo after undo “local”
  • Once more, with branching
  • Branch in time saves nine
  • Mass undo/redo
  • Fix an earlier commit
  • Stop tracking a tracked file

Each section has scenario with command(s) description and explanation what is happening behind the scenes. Older article but evergreen. Nice one!

[Read More]

Tags app-development cloud devops containers agile