Created
October 30, 2014 09:58
-
-
Save j4k/00460137a1ed3abbbb51 to your computer and use it in GitHub Desktop.
batch remote alter git remotes from base directory
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/bash | |
| for gitdir in `find ./ -name .git`; | |
| do | |
| workdir=${gitdir%/*}; | |
| echo; | |
| reponame=$(basename $(git --git-dir=$gitdir remote show -n origin | grep Fetch | cut -d: -f2-)); | |
| echo $reponame; | |
| neworigin="git@[REPLACE_WITH_URL]/$reponame"; | |
| echo $neworigin; | |
| git --git-dir=$gitdir --work-tree=$workdir remote remove origin; | |
| git --git-dir=$gitdir --work-tree=$workdir remote add origin $neworigin; | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment