David Sanders
David Sanders

Reputation: 4139

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) that 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?

Upvotes: 2

Views: 174

Answers (1)

knittl
knittl

Reputation: 265845

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

Upvotes: 3

Related Questions