Skip to content

Instantly share code, notes, and snippets.

@jsborjesson
Created April 28, 2015 16:10
Show Gist options
  • Select an option

  • Save jsborjesson/d97454f90ea682588221 to your computer and use it in GitHub Desktop.

Select an option

Save jsborjesson/d97454f90ea682588221 to your computer and use it in GitHub Desktop.
Recursively updates git remotes when you've renamed an organization
#!/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
@jsborjesson
Copy link
Author

Credits to @carhartl

@carhartl
Copy link

:)

@carhartl
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment