git revert

A Git command that creates a new commit undoing an earlier one, leaving the history intact.

In more detail

The mistake and its fix both stay in history, and no commit is rewritten, so revert is the safe way to undo a commit others already have. --no-edit accepts the generated message.

Example

git revert --no-edit HEAD

Related terms

Taught in

References

Certification courses