开发者

Git: How do I edit the message of a previous commit that is not the latest one?

开发者 https://www.devze.com 2023-04-10 22:40 出处:网络
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 h

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号