Guest User

Untitled

a guest
Mar 19th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. # Did your company change its email domain?
  4. # Use this handy script to change all of your git repos quickly and easily!
  5. # Don't worry, it'll only the change the repos where user.email was set to the old one!
  6.  
  7. # Usage: change_emails.bash username old_domain new_domain
  8. # Example: change_emails.bash maxine.mustermann boringdomain.com exciting.io
  9.  
  10. EMAIL_USER="$1"
  11. OLD_DOMAIN="$2"
  12. NEW_DOMAIN="$3"
  13.  
  14. change_email() {
  15. pushd $1;
  16. if [[ "$(git config user.email)" == "${EMAIL_USER}@${OLD_DOMAIN}" ]]; then
  17. git config user.email "${EMAIL_USER}@${NEW_DOMAIN}";
  18. fi;
  19. popd;
  20. }
  21. export -f change_email;
  22. find $1 -iname ".git" -exec bash -c 'change_email "$0"' {} \;
Add Comment
Please, Sign In to add comment