Undo With a New Commit
The latest commit broke something. Others already have it, so the history has to stay as it is. Make a new commit that undoes what it changed, with the message Git suggests.
Example 1
starts as
* e2bb074 (HEAD -> main) change a * 44553c0 add b * b527f18 first commit nothing to commit
ends as
commits, newest first: Revert "change a" change a add b first commit staged: nothing changed, not staged: nothing untracked: nothing a.txt: 1 b.txt: 2
Constraints
- 2 to 5 commits
- Nothing is edited or staged
Write it in your browser, against the clock. The model script, with a note on each command it uses, comes after.
More Git problems
- An Older CommitHard
- Both Sides MovedHard
- Commits per AuthorHard
- Find and PickHard
- Get Them BackHard
- On Top of MainHard
- Split the CommitHard
- The First Bad CommitHard