깃에서 커밋된 사용자정보 변경하기

깃에서 커밋된 사용자정보 변경하기

git filter-branch --force --env-filter "GIT_AUTHOR_NAME='NEW_NAME'; GIT_AUTHOR_EMAIL='NEW_EMAIL';" -- --all;
git filter-branch --force --env-filter "GIT_COMMITTER_NAME='NEW_NAME'; GIT_COMMITTER_EMAIL='NEW_EMAIL';" -- --all;

change committer

$ git filter-branch --force --env-filter '
    if [ "$GIT_COMMITTER_NAME" = "<OLD_NAME>" ]; then
        GIT_COMMITTER_NAME="<NEW_NAME>";
        GIT_COMMITTER_EMAIL="<NEW_EMAIL>";
    fi' -- --all

change author

$ git filter-branch --force --env-filter '
    if [ "$GIT_AUTHOR_NAME" = "<OLD_NAME>" ]; then
        GIT_AUTHOR_NAME="<NEW_NAME>";
        GIT_AUTHOR_EMAIL="<NEW_EMAIL>";
    fi' -- --all

change committer and author

$ git filter-branch --force --env-filter '
    if [ "$GIT_COMMITTER_NAME" = "<OLD_NAME>" ]; then
        GIT_COMMITTER_NAME="<NEW_NAME>";
        GIT_COMMITTER_EMAIL="<NEW_EMAIL>";
    elif [ "GIT_AUTHOR_NAME" = "<OLD_NAME>" ]; then
        GIT_AUTHOR_NAME="<NEW_NAME>";
        GIT_AUTHOR_EMAIL="<NEW_EMAIL>";
    fi' -- --all

Reference

Scroll to Top