https://www.git-tower.com/learn/git/faq/change-author-name-email/
copied from https://stackoverflow.com/a/60364176/1570165
git-filter-repo \
--name-callback 'return name.replace(b"OldName", b"NewName")' \
--email-callback 'return email.replace(b"[email protected]", b"[email protected]")'
But this will do git remote rm origin
though as mentioned here, newren/git-filter-repo#46 (comment).
So having these alias might be handy like below.
alias before-fix-email='git remote rename origin not-origin'
alias after-fix-email='git remote rename not-origin origin'
alias fix-git-email="git-filter-repo --email-callback 'return email.replace(b\"[email protected]\", b\"[email protected]\")'"
And you could use like this.
before-fix-email
fix-git-email -f
after-fix-email
# and of course you could combine all these into one alias/function as you wish
copied from https://stackoverflow.com/a/43884702/1570165
[includeIf "gitdir:~/company_a/"]
path = .gitconfig-company_a
[includeIf "gitdir:~/company_b/"]
path = .gitconfig-company_b
cat <<EOF | xargs -I _ echo [email protected]:_.git | xargs -I _ git submodule add -b main _
github/.github
github/gitignore
EOF