Skip to content

Instantly share code, notes, and snippets.

@daltonnyx
Forked from marschhuynh/reset-commit-author.md
Created January 26, 2021 09:21
Show Gist options
  • Save daltonnyx/b46539a40df2a57c3e9c24329d3b3c83 to your computer and use it in GitHub Desktop.
Save daltonnyx/b46539a40df2a57c3e9c24329d3b3c83 to your computer and use it in GitHub Desktop.
reset-commit-author
git filter-branch --force --commit-filter '
          if [ "$GIT_COMMITTER_EMAIL" = "wrong@email.com" ];
          then
                  export GIT_COMMITTER_NAME="New Name";
                  export GIT_AUTHOR_NAME="New Nam";
                  export GIT_COMMITTER_EMAIL="new@example.com";
                  export GIT_AUTHOR_EMAIL="new@example.com";
          fi;
          git commit-tree "$@"
  ' --tag-name-filter cat -- --all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment