0x00
要修改 git commit
信息,怎么办?
0x01
由于一些原因,想要批量修改 git commit
的用户信息,
1 2
| git clone [repo] && cd [repo] vim commit.sh
|
复制以下内容并编辑相应信息
OLD_EMAIL
、CORRECT_NAME
、CORRECT_EMAIL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| #!/bin/sh
git filter-branch --env-filter ' OLD_EMAIL="xxx" CORRECT_NAME="xxx" CORRECT_EMAIL="xxx" if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ] then export GIT_COMMITTER_NAME="$CORRECT_NAME" export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" fi if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ] then export GIT_AUTHOR_NAME="$CORRECT_NAME" export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL" fi ' --tag-name-filter cat -- --branches --tags
|
1 2
| chmod +x commit.sh ./commit.sh
|
0x02
封面出处:https://www.pixiv.net/member_illust.php?mode=medium&illust_id=60748017
参考资料: