Created
January 30, 2021 15:27
-
-
Save rmtsrc/8000ec884c88320aeaba0dbbe96682df to your computer and use it in GitHub Desktop.
Update all old email addresses in commits from all existing GitHub repos
This file contains 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
# Requires `git filter-repo` https://github.com/newren/git-filter-repo | |
mkdir tmp && cd tmp | |
export USERNAME="github-username" | |
export TOKEN="github-token-with-repo-access" | |
curl -u "$USERNAME:$TOKEN" "https://api.github.com/search/repositories?q=user:$USERNAME" | | |
grep -e 'ssh_url*' | | |
cut -d \" -f 4 | | |
xargs -L1 git clone | |
for d in ./*/ ; do | |
pushd "$d" | |
# ../my-mailmap | |
# New Name <[email protected]> <[email protected]> | |
# New Name <[email protected]> <[email protected]> | |
# etc. | |
git filter-repo --mailmap ../my-mailmap | |
git remote add origin [email protected]:$USERNAME/${PWD##*/}.git | |
git push --force origin master | |
popd | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment