Skip to content

Instantly share code, notes, and snippets.

@pserrano
Last active August 28, 2017 09:40
Show Gist options
  • Save pserrano/37146adfda6c1dc94bb81bbb69beb756 to your computer and use it in GitHub Desktop.
Save pserrano/37146adfda6c1dc94bb81bbb69beb756 to your computer and use it in GitHub Desktop.
Gitsuperpull
#!/bin/bash
DIRS=($(ls -d */))
PWD=($(pwd))
GIT="/.git/"
for i in "${DIRS[@]}"; do
if [[ "$i" == "parameters/" ]] || [[ "$i" == "jenkinsfile/" ]]; then
cd $i; PARA=($(ls -d */));
echo $i
for j in "${PARA[@]}"; do
echo $j
echo "Se empieza la actualización del repo $j"
cd $j; git fetch --all; git pull --all; cd ..
done
cd ..
else
echo "Se empieza la actualización del repo $i"
cd $i;
if [ ! -d "$PWD$GIT" ]; then
echo " El repositorio no es un repo git, Se pasa a siguiente directorio"
cd ..
else
git fetch --all; git pull --all; git submodule update; cd ..
fi
fi
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment