Scenario
You edited several files, accidentally staged one unrelated file and then made a commit with the wrong message. The goal is to repair the local history without losing useful work.
Approach
Inspect the status and staged diff first. Unstage the unrelated file while preserving its content, amend the latest commit if it has not been shared, and verify the resulting history and working tree.
What this exercise teaches
The important skill is not memorizing one command. It is understanding the difference between working-tree content, staged content and committed history so you can choose the least destructive operation.