mirror of
https://github.com/lloeki/toolbelt.git
synced 2025-12-06 01:54:41 +01:00
tool to rewrite email of commiter and author
This commit is contained in:
parent
1eaa4f6f04
commit
016d3b178a
1 changed files with 29 additions and 0 deletions
29
fix_commit_email.sh
Executable file
29
fix_commit_email.sh
Executable file
|
|
@ -0,0 +1,29 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
set -u
|
||||
|
||||
old_mail="$1"
|
||||
new_mail="$2"
|
||||
new_name="$3"
|
||||
shift
|
||||
shift
|
||||
shift
|
||||
|
||||
git filter-branch --env-filter '
|
||||
|
||||
OLD_EMAIL="'"$old_mail"'"
|
||||
CORRECT_NAME="'"$new_name"'"
|
||||
CORRECT_EMAIL="'"$new_mail"'"
|
||||
|
||||
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
|
||||
' "$@"
|
||||
Loading…
Add table
Add a link
Reference in a new issue