Skip to content

Instantly share code, notes, and snippets.

@sandrokeil
Last active January 5, 2016 21:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sandrokeil/b9098c8a5d0c35aa5a9c to your computer and use it in GitHub Desktop.
Save sandrokeil/b9098c8a5d0c35aa5a9c to your computer and use it in GitHub Desktop.
git-batch-upstream
#!/bin/bash
if [ "$#" -ne 1 ]; then
echo "First parameter is a file with a list of repos and second parameter (optional) is git path e.g. git-batch-upstream repos.txt git@github.com:sandrokeil/"
fi
ROOTDIR=$(pwd)
cd $ROOTDIR
cat $1 | while read line
do
cd $ROOTDIR/$line
if [ ! -z "$2" ]
then
git remote add upstream $2$line
fi
git fetch upstream
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment