Change old commit message on Git

后端 未结 5 1018
南旧
南旧 2020-12-12 09:24

I was trying to edit an old commit message as explained here.

The thing is that now, when I try to run rebase -i HEAD~5 it says interactive rebas

5条回答
  •  醉梦人生
    2020-12-12 10:02

    Here's a very nice Gist that covers all the possible cases: https://gist.github.com/nepsilon/156387acf9e1e72d48fa35c4fabef0b4

    Overview:

    git rebase -i HEAD~X
    # X is the number of commits to go back
    # Move to the line of your commit, change pick into edit,
    # then change your commit message:
    git commit --amend
    # Finish the rebase with:
    git rebase --continue
    

提交回复
热议问题