You made a typo in your last commit message and have not pushed.
BeginnerScenarioUndoing Mistakes
Answer
Situation read → Only the message needs change.
What I'd do →
git commit --amend -m "Fix login redirect for SSO users".- To also add a forgotten file:
git add file && git commit --amend --no-edit.
Why → Amend replaces the last commit with a new one (new SHA). That is safe only while nobody else has the old one.
Interview tip → If it is already pushed to a shared branch, do not amend; add a follow-up commit instead.
More on Undoing Mistakes
You committed on `main` when you meant to be on a feature branch. Nothing is pushed. Fix it.BeginnerA bad commit is already on shared `main`. Others have pulled it. How do you undo it?IntermediateYou ran `git reset --hard` and lost uncommitted-then-committed work. Can you get it back?IntermediateYou need to revert a merge commit on `main`. `git revert` says "commit is a merge but no -m option was given".IntermediateYou deleted a local branch with unmerged work by mistake.BeginnerAfter `git stash pop` you got conflicts. Is your stash lost?Intermediate