Created
October 3, 2013 03:39
-
-
Save DekusDenial/6804554 to your computer and use it in GitHub Desktop.
Loop through all the forked repos, update the remote upstream and rebase it with the current local HEAD.
With '-f' flag to push after performing the tasks above, for each repo.
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
#!/usr/bin/env sh | |
push=0 | |
if [[ $# -eq 1 && $1 -eq '-f' ]]; then | |
push=1 | |
fi | |
T1=$(date +%s) | |
cwd=$(pwd) | |
repoCount=0 | |
for d in *; do | |
if [ -d "${d}" ]; then | |
echo "\n<<<<<<<<<< Updating [${d}] & Rebase with upstream >>>>>>>>>>" | |
cd ${d} | |
HEAD=$( git rev-parse --abbrev-ref HEAD ) | |
git fetch upstream && git checkout ${HEAD} | |
git rebase upstream/${HEAD} | |
[ $push -eq 1 ] && git push origin ${HEAD} | |
repoCount=$((repoCount + 1)) | |
cd ${cwd} | |
fi | |
done | |
T2=$(date +%s) | |
echo "\n<<<<<<<<<< Total Took $(($T2 - $T1))s to update ${repoCount} repos >>>>>>>>>>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment