Fix old git commit author info
To learn which repos need the info corrected:
cd ~/dev/sync-git/ for word in * ; do ( cd "${word}" ; git log --pretty=format:'%an,%ae' | sort -u | sed -r -e "s/^/${word},/;" ; ) ; done | grep 'localhost|example' ~/fix3
I inspected ~/fix3 and found two projects that had incorrect email addresses.
Now, prepare a script, ~/fix-git-commits.sh
In the two repositories that needed to have info corrected, run this script.
cd ~/dev/project1 sh ~/fix-git-commits.sh
Then, you can just force-push each branch to each remote.
I also had to manually re-tag each tag. I just matched exact commit time and manually ran:
git tag --force v2.1 330b3e91f357f54668c54d5e543a7f3138b77ad7
And then I force-pushed the tags to each remote.
git push --tags local --force git push --tags cloud --force
Future reading
- Gitlab has some extra steps I should bother to do, but I haven't yet: https://docs.gitlab.com/ee/user/project/repository/reducing_the_repo_size_using_git.html
References
- Slightly modified from https://www.git-tower.com/learn/git/faq/change-author-name-email/
Comments