Change Author Info of Past Commits - egnomerator/misc GitHub Wiki
- This link is to a Stack Overflow post requesting help to change author information on past commits
- If performing the below operation(s) results in re-writing public history, then pushing changes with require the force flag
In case the link included above ever breaks, here is the pertinent information from the Stack Overflow post
I would like to change my name, surname and email in my all commits, is it possible?
To rewrite both author and committer in all selected commits:
git filter-branch --commit-filter \
'if [ "$GIT_AUTHOR_NAME" = "OldAuthor Name" ]; then \
export GIT_AUTHOR_NAME="Author Name";\
export [email protected];\
export GIT_COMMITTER_NAME="Commmiter Name";\
export [email protected];\
fi;\
git commit-tree "$@"'
My personal use case for this action was the following:
- I had been working on a personal project for awhile making commits under certain author information
- I later decided to use a particular set of author information for all of my personal projects
- I began using my chosen author information for new commits on that personal project
- I realized I wanted to have my commit history show the same author information for all my commits
- Since I was the only committer on the project, I wanted all the author information to be consistent