Last active
May 7, 2020 15:04
-
-
Save noahp/08cfc816b59b7c3ec6a39ae60f8f58dc to your computer and use it in GitHub Desktop.
git reset all authors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# disable warning for using filter branch, we don't care lalala | |
export FILTER_BRANCH_SQUELCH_WARNING=1 | |
# rewrite all authors to = committer. | |
git filter-branch --commit-filter \ | |
'GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" GIT_AUTHOR_EMAIL="$GIT_COMMITTER_EMAIL" git commit-tree "$@"' | |
# these are good examples: | |
# https://git-scm.com/docs/git-filter-branch#_examples | |
# if you wanted to eg do a replace on certain author email: | |
git filter-branch --commit-filter ' | |
if [ "$GIT_AUTHOR_EMAIL" = "<[email protected]>" ]; | |
then | |
GIT_AUTHOR_EMAIL="<[email protected]>" git commit-tree "$@"; | |
else | |
git commit-tree "$@"; | |
fi' HEAD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment