Skip to content

Instantly share code, notes, and snippets.

@benjishults
Created April 5, 2019 13:34
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 benjishults/899c246ccc60a21ec798068c268f38f5 to your computer and use it in GitHub Desktop.
Save benjishults/899c246ccc60a21ec798068c268f38f5 to your computer and use it in GitHub Desktop.
pull upstream
#!/bin/bash
# put this file in the folder containing your repo folders.
# when run, it will try to do a git pull upstream of the current branch of each repo and print a message on each failure.
pushd . &> /dev/null
for dir in $( find . -maxdepth 1 -type d -print )
do
popd &> /dev/null
pushd "$dir" &> /dev/null
if
[ "$dir" != "." -a -d .git ]
then
if git pull upstream $(git branch | grep -e "^*" | cut -d' ' -f 2)
then
: # echo "pulled upstream in ${dir}"
else
echo -e "\033[1;31mpull upstream failed in ${dir}\033[0m"
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment