Update your local GIT repositories.

 

How to update all your local GIT repositories ?


Script bash

#!/bin/bash
CUR_DIR=$(pwd)
echo "\n\033[1mPulling in latest changes.\033[0m"
for i in $(find . -name ".git" | cut -c 3-);do 
echo "";echo "\033[1m"$i"\033[0m";echo "";
cd "$i";cd ..;git pull origin master;cd $CUR_DIR
done
echo "\n\033[32mComplete.\033[0m\n"

How to ?

  • Name this script _github.sh
  • Put this script on the subfolder of your local repository.
  • in my case host3r is located at /usr/local/git/host3r
  • So this script is located at /usr/local/git/_github.sh
  • Then cd /usr/local/git and sh _github.sh

Result

Pulling in latest changes

cansina/.git

From https://github.com/deibit/cansina
 * branch            master     -> FETCH_HEAD
Already up-to-date.

cewl/.git

From https://github.com/digininja/CeWL
 * branch            master     -> FETCH_HEAD
Already up-to-date.

cloudflare/.git

From https://github.com/pirate/sites-using-cloudflare
 * branch            master     -> FETCH_HEAD
Already up-to-date.

Leave a Comment