Skip to content

    Git revert

    Web design & developmentUndo change by counter-commit
    Reading time: 2 min.Editorially reviewed on:

    Definition

    Git revert creates new changes that undo the effect of selected earlier commits.

    Git revert calculates counter-changes to selected commits and usually records them as new commits. The original commits remain in the history. This distinguishes revert from methods that reset references or rewrite the visible history.

    Simply explained

    You add a new version that undoes a previous change instead of deleting its history.

    Why it matters in practice

    This is helpful for shared histories because the undo itself remains traceable and can be regularly propagated.

    Example from business

    Possible example: A team reverts a faulty function commit by a new revert commit and then tests the restored function.

    Limits and pitfalls

    • Later changes can cause conflicts. Undoing a merge commit requires special attention; even a successful revert must be technically reviewed.

    Origin & history

    Git distinguishes rewriting a history from a documented counter-change. Revert belongs to the second variant and preserves the visible decision history.

    Use in mid-sized companies

    • An organization uses revert for traceable undos and documents which change was affected and how the result was verified.

    Frequently asked questions

    Does revert delete the original commit?

    No. It remains; an additional commit undoes its changes as far as possible.

    Sources

    Editorially reviewed on:

    On this page

    Next step

    Put knowledge into practice