Edit the root commit in Git?

前端 未结 5 1244
予麋鹿
予麋鹿 2020-11-22 16:33

There\'s ways to change the message from later commits:

git commit --amend                    # for the most recent co         


        
5条回答
  •  暖寄归人
    2020-11-22 17:30

    Assuming that you have a clean working tree, you can do the following.

    # checkout the root commit
    git checkout 
    
    # amend the commit
    git commit --amend
    
    # rebase all the other commits in master onto the amended root
    git rebase --onto HEAD HEAD master
    

提交回复
热议问题