Skip to content

Instantly share code, notes, and snippets.

@iamawmrit
Last active May 16, 2023 10:01
Show Gist options
  • Save iamawmrit/a1f62b79b9a19b79004e26212e2229a6 to your computer and use it in GitHub Desktop.
Save iamawmrit/a1f62b79b9a19b79004e26212e2229a6 to your computer and use it in GitHub Desktop.
Rewrite git history
git filter-branch --env-filter '
if [ "$GIT_AUTHOR_EMAIL" = "email@email.com" ]; then
GIT_AUTHOR_NAME="username"
GIT_AUTHOR_EMAIL="email2@email2.com"
fi
if [ "$GIT_COMMITTER_EMAIL" = "email@email.com" ]; then
GIT_COMMITTER_NAME="username"
GIT_COMMITTER_EMAIL="email2@email2.com"
fi
' --tag-name-filter cat -- --branches --tags
@iamawmrit
Copy link
Author

To replace the author from commits.

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