Use github script to change commit's author
https://help.github.com/articles/changing-author-info/
This commit is contained in:
parent
0a4fce1f29
commit
7432d6dd96
|
@ -1,13 +1,22 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
git filter-branch --commit-filter '
|
git filter-branch --env-filter '
|
||||||
if [ "$GIT_COMMITTER_NAME" = "OLD_USERNAME" ];
|
OLD_EMAIL="old_username@email"
|
||||||
|
CORRECT_NAME="LastName FirstName"
|
||||||
|
CORRECT_EMAIL="username@email"
|
||||||
|
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
|
||||||
then
|
then
|
||||||
GIT_COMMITTER_NAME="NEW_USERNAME";
|
export GIT_COMMITTER_NAME="$CORRECT_NAME"
|
||||||
GIT_AUTHOR_NAME="NEW_USERNAME";
|
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
|
||||||
GIT_COMMITTER_EMAIL="EMAIL_NEW_USERNAME";
|
fi
|
||||||
GIT_AUTHOR_EMAIL="EMAIL_NEW_USERNAME";
|
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
|
||||||
git commit-tree "$@";
|
then
|
||||||
else
|
export GIT_AUTHOR_NAME="$CORRECT_NAME"
|
||||||
git commit-tree "$@";
|
export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
|
||||||
fi' HEAD
|
fi
|
||||||
|
' --tag-name-filter cat -- --branches --tags
|
||||||
|
|
||||||
|
printf '%b' "You can check you git history, then run :\n"
|
||||||
|
printf '%b' "git push --force --tags origin 'refs/heads/*'"
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue