Skip to content

Revert

← All terms · Git fundamentals

A safe way to undo a specific commit by creating a brand new commit that performs the exact opposite actions of the original.

What it is

Unlike reset, which deletes history, revert creates a new snapshot that reverses the changes of a previous one. If a commit added a line of code, the revert commit will remove that line. This preserves the project's historical integrity, making it safe for collaborative environments.

When you would use it

You use revert when you realize a recent change broke the application, and you need to undo it publicly without deleting the history of what happened.

Common operations

  • Undoing a deployed feature that is causing production bugs.
  • Safely rolling back a mistake on a shared branch.

Related terms

Where this is taught

No learning path uses this term yet. Browse the Learning Atlas for guided sequences through related ideas.

Going deeper