修改已经提交的commit的message
不小心写错committing message并且已经提交怎么修改呢?
Easiest solution (but please read this whole answer before doing this):
git rebase -i <hash-of-commit-preceding-the-incorrect-one>(这里可以用要改的那次的hash,如果是前一两次也可以用HEAD^或者HEAD^^)(这里的hash code必须是要修改的的那次提交的前一次commit的hash code)
- In the editor that opens, change
pick
toreword
on the line for the incorrect commit. - Save the file and close the editor.
- The editor will open again with the incorrect commit message. Fix it.
- Save the file and close the editor.
git push --force
to update GitHub.
转过来以防忘记