Modify commit message of past commit in git

This question already has an answer here:

  • How to modify existing, unpushed commits? 27 answers

  • This generally can't be done in a completely safe manner regardless of context, but it can be done.

    The easiest way to do it is to do an interactive rebase ( potentially preserving merges ) and marking that you'd like to edit the commit messages, editing them and then force pushing the branch.

    This will alter the hashes of all the commits starting from the first one you modify to the tip of the branch. If this branch is merged to master already, this is probably a bad idea unless you check with everyone else involved with the project.

    Before you start this endeavor I strongly suggest you consider whether anyone else has consumed your branch yet, are there any merges you have to preserve, etc.

    链接地址: http://www.djcxy.com/p/1412.html

    上一篇: 在一个特定的提交中更改提交作者

    下一篇: 在git中修改过去提交的提交消息