Overview
Scenario A: A file was edited incorrectly but not staged.
git status
git restore 1.txt
git status
Scenario B: Several changes were staged together by mistake.
git status
git reset
git status
Then stage only the intended files.
Scenario C: A tracked file should be deleted and included in the next commit.
git rm 4.txt
git status
git commit -m "Remove 4.txt"
Scenario D: A local file should remain on disk but no longer be tracked.
git rm --cached 4.txt
git status
Scenario E: An earlier commit introduced a mistake that should be visibly corrected.
git log --oneline
git revert <commit-id>
git log --oneline
The log now contains both the original commit and the later revert commit.