Back to all posts

how to change committer and author in git


#!/bin/bash

export FILTER_BRANCH_SQUELCH_WARNING=1 # This will suppress the warning shown by git

git filter-branch -f --env-filter '
    if test "$GIT_AUTHOR_EMAIL" = "richard.roe@gmail.com"
    then
        GIT_AUTHOR_NAME="John Doe"
        GIT_AUTHOR_EMAIL=john.doe@gmail.com
    fi
    if test "$GIT_COMMITTER_EMAIL" = "richard.roe@gmail.com"
    then
        GIT_COMMITTER_NAME="John Doe"
        GIT_COMMITTER_EMAIL=john.doe@gmail.com
    fi
' HEAD

Read More :https://dev.to/rajhawaldar/how-to-chane-author-name-and-the-email-of-the-commit-4a9o