How to reset author of earlier commit?

前端 未结 2 1358
抹茶落季
抹茶落季 2021-01-27 09:00

My local commits have wrong email so I used the following command to reset it. However, it only reset the latest local commit. How to reset the earlier ones?

git          


        
2条回答
  •  长情又很酷
    2021-01-27 09:33

    Assuming you have a linear history, you can reset the authorship of all commits with

    git rebase -i --exec 'git commit --amend --reset-author --no-edit' --root
    

    If only a subset of commits is affected, which still must be all in a linear history, replace --root with the commit ID before the first one of yours.

提交回复
热议问题