Reverting a Change in Shared History
A revert can record an inverse change as a new commit while preserving the original change in ancestry.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Trace a simple correction
A commit increases a display limit from 10 to 12. Reverting it can record a new snapshot with 10, while both commits remain in the shared history. The commit snapshot separates current content from earlier state.
Check later assumptions
If a subsequent edit expects 12, blindly reversing the earlier change can cause misbehavior or a conflict. Review the surrounding diff and verify the intended current contract after the revert.[1]
Represent undo as a new change on top of the branch
If commit B changes limit from twenty to forty, a revert commit can apply the inverse after B. The branch still contains B and the newer record of the reversal. Readers of earlier commits can see when each decision was active. See history by path.
A: limit 20
B: limit 40
R after B: revert result, limit 20
History includes A, B and R
Check intervening changes before assuming an exact reversal
An intervening commit may alter the same field or rely on the new limit. Applying the inverse can conflict or produce unexpected behavior. Review the result through the current program and test affected callers.