Created
May 19, 2018 06:19
-
-
Save mhshimul/09d28fa8ee21f3b55319e8584bc13a15 to your computer and use it in GitHub Desktop.
This file contains 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 | |
DIRS=`ls -l $MYDIR | egrep '^d' | awk '{print $9}'` | |
# "ls -l $MYDIR" = get a directory listing | |
# "| egrep '^d'" = pipe to egrep and select only the directories | |
# "awk '{print $9}'" = pipe the result from egrep to awk and print only the 9th field | |
# and now loop through the directories: | |
for DIR in $DIRS | |
do | |
echo "setting up ${DIR}" | |
cd ${DIR} | |
echo "removing remote origin" | |
git remote remove origin | |
echo "adding bitbucket url as remote origin" | |
git remote add origin https://username@bitbucket.org/<organization>/${DIR}.git | |
echo "pulling" | |
git pull | |
git checkout master | |
echo "setting upstream branches" | |
git branch --set-upstream-to=origin/master master | |
git branch --set-upstream-to=origin/release release | |
echo "done" | |
cd .. | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment