DELAPARRA
Index
Color
NL
Category: Git commands

git revert

Explained by Updated

What is git revert?

git revert: Create a new commit that undoes the changes from a previous commit — safe for shared branches. git revert undoes the changes of an earlier commit by creating a new commit that does the opposite. History is not rewritten; the original commit stays, followed by its reversal. That makes it the safe way to undo something on a shared branch, such as main or a release branch. Colleagues pull the revert like any other commit, and nobody's history breaks.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about git revert

What should you keep in mind with git revert?

It is often the fastest response when a deploy causes problems. Revert the commit, deploy, and fix the real issue calmly afterwards. Reverting a merge commit needs -m 1 to say which parent to keep, and re-merging the same branch later requires reverting the revert first. Write a short reason in the revert message, so the history explains why the change was undone.

At a glance

CategoryGit commands
Explained by
Updated

More Git commands terms

All terms starting with G

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.