Created
April 5, 2019 13:34
-
-
Save benjishults/899c246ccc60a21ec798068c268f38f5 to your computer and use it in GitHub Desktop.
pull upstream
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 | |
# 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