A Git reset is your strongest move when a branch has gone off course. It rewinds history to the exact state you choose. No manual patching, no tangled merges. When a contract amendment lands in your codebase—whether from a third-party API agreement, schema evolution, or a business rule update—you can’t risk stale commits or partial changes. The amendment defines new terms. The repo must match.
Start with clarity on the type of reset.
git reset --softkeeps changes staged for recommit after aligning with the amendment.git reset --mixedunstages but preserves work in files so you can adapt quickly.git reset --hardclears everything to match the target commit—critical when the amendment invalidates old logic.
Map the amendment to the exact scope in your Git history. If the change affects multiple services, reset to the last stable commit before deviation. Then pull in the new contract version, update your code, and commit cleanly. This eliminates ghost code and contract drift.