Skip to content

Instantly share code, notes, and snippets.

@oxcar103
Last active October 22, 2017 16:57
Show Gist options
  • Save oxcar103/697520c3db16613f9b12 to your computer and use it in GitHub Desktop.
Save oxcar103/697520c3db16613f9b12 to your computer and use it in GitHub Desktop.
Script to update a group of repositories of GitHub :octocat:
#! /bin/bash
# Para corregir errores con los directorios que contengan espacios:
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
a=$PWD
# A partir del directorio actual, buscamos los directorios con la carpeta oculta ".git"
# y le quitamos el primer y último campo ya que serán "." y ".git", respectivamente.
for b in $(find ./ -name ".git" | cut -d/ -f 2- | rev | cut -d/ -f 2- | rev);
do
echo $b":"
cd ./$b
git pull
cd $a
done;
# Restauramos el valor modificado
IFS=$SAVEIFS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment