Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- # Did your company change its email domain?
- # Use this handy script to change all of your git repos quickly and easily!
- # Don't worry, it'll only the change the repos where user.email was set to the old one!
- # Usage: change_emails.bash username old_domain new_domain
- # Example: change_emails.bash maxine.mustermann boringdomain.com exciting.io
- EMAIL_USER="$1"
- OLD_DOMAIN="$2"
- NEW_DOMAIN="$3"
- change_email() {
- pushd $1;
- if [[ "$(git config user.email)" == "${EMAIL_USER}@${OLD_DOMAIN}" ]]; then
- git config user.email "${EMAIL_USER}@${NEW_DOMAIN}";
- fi;
- popd;
- }
- export -f change_email;
- find $1 -iname ".git" -exec bash -c 'change_email "$0"' {} \;
Add Comment
Please, Sign In to add comment