Skip to content

Instantly share code, notes, and snippets.

@mateuschmitz
Created March 21, 2018 14:40
Show Gist options
  • Save mateuschmitz/dfefd712d89d7ec1f4af8dc3cbfb2409 to your computer and use it in GitHub Desktop.
Save mateuschmitz/dfefd712d89d7ec1f4af8dc3cbfb2409 to your computer and use it in GitHub Desktop.
#!/bin/bash
for DIR in */ ; do
if [ -d "$DIR/.git" ]; then
cd $DIR
BRANCH=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
echo "Atualizando: "$DIR "("$BRANCH")"
echo "===================================================="
git pull origin $BRANCH
git fetch --all
cd ../
echo -e "\n"
else
for DIR1 in $DIR/* ; do
if [ -d "$DIR1/.git" ]; then
cd $DIR1
BRANCH=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
echo "Atualizando: "$DIR1 "("$BRANCH")"
echo "===================================================="
git pull origin $BRANCH
git fetch --all
cd ../../
echo -e "\n"
fi
done
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment