Could I change my name and surname in all previous commits?

后端 未结 6 1203
春和景丽
春和景丽 2020-11-27 08:57

I would like to change my name, surname and email in my all commits, is it possible?

6条回答
  •  爱一瞬间的悲伤
    2020-11-27 09:38

    To rewrite both author and commiter in all selected commits:

    git filter-branch --commit-filter \
    'if [ "$GIT_AUTHOR_NAME" = "OldAuthor Name" ]; then \
    export GIT_AUTHOR_NAME="Author Name";\
    export GIT_AUTHOR_EMAIL=authorEmail@example.com;\
    export GIT_COMMITTER_NAME="Commmiter Name";\
    export GIT_COMMITTER_EMAIL=commiterEmail@example.com;\
    fi;\
    git commit-tree "$@"'
    

提交回复
热议问题