Last active
August 27, 2018 21:22
-
-
Save amelialaundy/8c4eac05b052864e27e184cc16f1b24b to your computer and use it in GitHub Desktop.
pull all changes to given branch for upstream git repos in a folder, default to merge from 'develop' into current branch
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 | |
[[ $2 = "" ]] && BRANCH_NAME="develop" || BRANCH_NAME="$1" | |
# Let the person running the script know what's going on. | |
echo "Pulling in latest changes for all upstream repositories in $pwd..." | |
echo $BRANCH_NAME; | |
# Find all folders and update it to the given branch latest revision | |
for d in */ ; do | |
echo ""; | |
echo "current repo: $d"; | |
# cd into the folder | |
cd "$d"; | |
# pull from chosen branch | |
echo "pulling upstream"; | |
# get upstream changes from main repo; | |
git fetch upstream; | |
# merge changes into my fork for given branch name | |
git merge upstream/$BRANCH_NAME | |
# lets get back to the parent directory | |
cd ..; | |
done | |
echo "Complete!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment