Last active
June 24, 2016 10:05
-
-
Save childnode/c03e32289a94fe4859f04b82fddf5d6d to your computer and use it in GitHub Desktop.
recursive `git update remote` #git #cmdline #script
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
## usage: `rgur origin currentRemote.example.com newRemote.example.com` | |
rgur () | |
{ | |
test -d .git && ( echo "found git repo in $i" && ( git remote set-url $1 $(git remote get-url $1 |sed -e 's/'$2'/'$3'/') ); | |
echo "UPDATED $1 : $(git remote get-url $1)" ) || ( for i in *; | |
do | |
test -d "$i" && ( builtin cd "$i" && rgur $1 $2 $3); | |
done ) | |
} |
Eingereichter Verbesserungsvorschlag:
ersetze git remote get-url origin
durch git config --get remote.origin.url
da er ggf. sonst versucht das alte repo zu erreichen?!?! erschließt sich mir persönlich noch nicht, aber vielleicht kann mir das ja jemand erklären ;)
rgur ()
{
test -d .git && ( echo "found git repo in $i" && ( git remote set-url $1 $(git config --get remote.origin.url |sed -e 's/'$2'/'$3'/') );
echo "UPDATED $1 : $(git config --get remote.origin.url)" ) || ( for i in *;
do
test -d "$i" && ( builtin cd "$i" && rgur $1 $2 $3);
done )
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
see also rgfa.sh