Git · History and recovery

git revert

Creates a new commit that undoes an earlier one. It is safe on shared history.

Syntax
git revert <commit>

Example

Example
git revert 1a2b3c4

More in this group

git clean git reflog git reset --hard git reset --mixed git reset --soft git restore git stash git stash apply vs pop

Learn this in the course

Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.

Open the course