Amend a commit that wasn't the previous commit
This question already has an answer here:
You can use git rebase
to solve this. Run git rebase -i sha1~1
where sha1 is the commit hash of the one you want to change. Find the commit you want to change, and replace "pick" with "edit" as described in the comments of the rebase editor. When you continue from there, you can edit that commit.
Note that this will change the sha1 of that commit as well as all children -- in other words, this rewrites the history from that point forward. You can break repositories doing this, but if you haven't pushed, it's not as much of a big deal.
链接地址: http://www.djcxy.com/p/23422.html上一篇: 如何编辑git中任何提交的提交消息?
下一篇: 修改一个不是以前提交的提交