Is it possible to fix an old commit in git?

This question already has an answer here:

  • How to modify a specified commit in git? 10 answers

  • Yes, you can do that if you don't push elsewhere and preferably if you have linear history. You just commit you minor things and use git rebase --interactive , then you can either reorder and squash or edit your commits.


    Checkout that commit

    Make the changes and commit with --amend to modify it

    Rebate the missing commits back onto head and you should be where you are now with the amends in place


    只需创建一个新的提交添加所需的更改与主题“fixup![提交消息git rebase --interactive --autosquash ]”并运行git rebase --interactive --autosquash

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

    上一篇: Git:如何融合提交到另一个提交?

    下一篇: 是否有可能在git中修复旧的提交?