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

后端 未结 30 3129
野性不改
野性不改 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:14

    Your problem is really common. See "Using Mailmap to Fix Authors List in Git"

    For the sake of simplicity, I have created a script to ease the process: git-changemail

    After putting that script on your path, you can issue commands like:

    • Change author matchings on current branch

      $ git changemail -a old@email.com -n newname -m new@email.com
      
    • Change author and committer matchings on and . Pass -f to filter-branch to allow rewriting backups

      $ git changemail -b old@email.com -n newname -m new@email.com -- -f <branch> <branch2>
      
    • Show existing users on repo

      $ git changemail --show-both
      

    By the way, after making your changes, clean the backup from the filter-branch with: git-backup-clean

提交回复
热议问题