NaraLuwan / NaraLuwan.github.io

Personal Website
https://hechao.me
1 stars 0 forks source link

批量订正已推送的commit记录的用户名和邮箱 #1

Closed NaraLuwan closed 5 years ago

NaraLuwan commented 5 years ago

!/bin/sh

git filter-branch --env-filter '

OLD_EMAIL="old-email@example.com" CORRECT_NAME="Correct Name" CORRECT_EMAIL="correct-email@example.com"

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