Sakthi Karthik Sakthi Karthik - 5 months ago 32
Git Question

how to rename author name in GIT version control after pushed many changes?

I am using

git
version control.

I've committed and pushed some changes with my first name as author name. then many authors committed and pushed our changes, but now I need to change the committed author name only not message.

Is any way to do this changes?

Answer Source

It seems you want to change the author name for all the commit histories. You can use git filter-branch to change the author name:

git filter-branch --commit-filter '
        if [ "$GIT_AUTHOR_NAME" = "old name" ];
        then
                GIT_AUTHOR_NAME="new name";
                git commit-tree "$@";
        else
                git commit-tree "$@";
        fi' HEAD

It will take a few minutes to rewrite the commit history.

After that you can use git push -f --all to update the remote repo.