How do you fix the message of a commit that is not the latest?
Run git rebase -i, mark that commit as reword, save, and edit the message. Only do this for commits not yet shared, since every commit after it also gets a new hash.
Explain it simply
Amend only handles the last commit. For one further back, you open the rebase list and tell Git which message to edit.
Start git rebase -i HEAD~5 so the target is in the list. Change pick to reword on that line, save, and Git pauses on that commit to let you type the new message. Then it replays the rest. All later commits get new hashes. For a commit already pushed to a shared branch, leave it alone or add a note in a follow-up commit.
Example
git rebase -i HEAD~5
# change: pick 8a9b0c1 wip -> reword 8a9b0c1 wip
# editor opens, type: Add OTP resend button
git push --force-with-leaseWhat to say in the interview
"I use git rebase -i to reach the commit, change pick to reword, and type the new message. Later commits are rewritten too, so I only do it on unshared work and push with --force-with-lease."