Skip to content

Instantly share code, notes, and snippets.

@st3v
Created February 1, 2013 07:28
Show Gist options
  • Save st3v/4689904 to your computer and use it in GitHub Desktop.
Save st3v/4689904 to your computer and use it in GitHub Desktop.
Manipulate committer/author for historic git commits
# set author/committer for ALL commits in the history
git filter-branch --env-filter '
export GIT_AUTHOR_NAME=new_name
export GIT_AUTHOR_EMAIL=new@foo.bar
export GIT_COMMITTER_NAME=new_name
export GIT_COMMITTER_EMAIL=new@foo.bar'
# change author/committer for all commits from a particular individual
git filter-branch --env-filter '
if [ $GIT_AUTHOR_NAME = old_name ]
then
export GIT_AUTHOR_NAME=new_name
export GIT_AUTHOR_EMAIL=new@foo.bar
export GIT_COMMITTER_NAME=new_name
export GIT_COMMITTER_EMAIL=new@foo.bar
fi' -f
# change author/committer for a particular commit
git filter-branch --env-filter '
if [ $GIT_COMMIT = <commit-id> ]
then
export GIT_AUTHOR_NAME=new_name
export GIT_AUTHOR_EMAIL=new@foo.bar
export GIT_COMMITTER_NAME=new_name
export GIT_COMMITTER_EMAIL=new@foo.bar
fi' -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment