DevOp's Blog

jakshi's devop blog.

Rewriting Your Email in Git Commits

Sometimes you need to rewrite your email in your commits in some git repository. Do it with command:

git filter-branch --env-filter 'if [ $GIT_AUTHOR_EMAIL = bad@email ]; then GIT_AUTHOR_EMAIL=correct@email; fi; export GIT_AUTHOR_EMAIL'

For your collaborators this operatioin might be dangerous. According to Jakub Narębski collaborators will need to:

  • if they didn’t base their work on history pre-rewrite, just git reset --hard origin/master or just git pull origin (which should fast-forward).
  • If they based their change, they have to rebase using git rebase origin/master or just git pull --rebase origin

More info:

Comments