Created
April 28, 2015 16:10
-
-
Save jsborjesson/d97454f90ea682588221 to your computer and use it in GitHub Desktop.
Recursively updates git remotes when you've renamed an organization
This file contains hidden or 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
| #!/bin/sh | |
| for i in $(find $PWD -maxdepth 1 -type d); do | |
| cd $i | |
| if [ -d .git ]; then | |
| remotes=$(git remote -v) | |
| if [[ "$remotes" =~ [email protected]:myorg ]]; then | |
| git remote set-url origin [email protected]:myneworg/$(basename `git rev-parse --show-toplevel`) | |
| fi | |
| fi | |
| cd .. | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Credits to @carhartl