Git: How do I edit the message of a previous commit that is not the latest one?
I just realized that I left one word in the commit message of a previous commit (so I can't use git commit --amend) t开发者_StackOverflowhat makes the message mean completely the opposite of what I had intended.
The commit in question is HEAD~2 on my current branch, which is ahead of the branch base. How can I edit just the message on that commit?
Use interactive rebase and mark that commit with r
(reword):
git rebase -i HEAD~3
Don't use rebase if your history was already made public
精彩评论