Skip to content

Instantly share code, notes, and snippets.

@makomweb
Created January 19, 2021 15:02
Show Gist options
  • Save makomweb/93919a77c60d58da0ec8c3b0de2d5e45 to your computer and use it in GitHub Desktop.
Save makomweb/93919a77c60d58da0ec8c3b0de2d5e45 to your computer and use it in GitHub Desktop.
Change committer and author of all commits in a repo
#!/bin/sh
# Credits: http://stackoverflow.com/a/750191
git filter-branch -f --env-filter "
GIT_AUTHOR_NAME='__AUTHOR_NAME__'
GIT_AUTHOR_EMAIL='__AUTHOR_EMAIL_ADDRESS__'
GIT_COMMITTER_NAME='__COMMITTER_NAME__'
GIT_COMMITTER_EMAIL='__COMMITTER_EMAIL_ADDRESS__'
" HEAD
@makomweb
Copy link
Author

run
git rebase -i <sha1 or ref of starting point>

mark all commits that you want to change with edit (or e )
loop the following two commands until you have processed all the commits:
git commit --amend --reuse-message=HEAD --author="New Author <new@author.email>"
and
git rebase --continue

@makomweb
Copy link
Author

run
git update-ref -d refs/original/refs/heads/master

afterwards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment