How to change the author and committer name and e-mail of multiple commits in Git?

后端 未结 30 3055
野性不改
野性不改 2020-11-21 04:50

I was writing a simple script in the school computer, and committing the changes to Git (in a repo that was in my pendrive, cloned from my computer at home). After several c

30条回答
  •  灰色年华
    2020-11-21 05:08

    1. run git rebase -i

    2. mark all commits that you want to change with edit (or e)

    3. loop the following two commands until you have processed all the commits:

      git commit --amend --reuse-message=HEAD --author="New Author " ; git rebase --continue

    This will keep all the other commit information (including the dates). The --reuse-message=HEAD option prevents the message editor from launching.

提交回复
热议问题