Skip to content

Instantly share code, notes, and snippets.

@kaeza
Created January 11, 2017 23:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaeza/309e5230bf183049b7394b309c9361b9 to your computer and use it in GitHub Desktop.
Save kaeza/309e5230bf183049b7394b309c9361b9 to your computer and use it in GitHub Desktop.
#! /bin/bash
cd "$(dirname "$0")";
errs="";
nl='
';
for dir in *; do
[[ -d "$dir/.git" ]] && {
echo "GIT $dir";
pushd "$dir";
[[ "$(git branch | grep '^\* .*' | cut -c 3-)" = "master" ]] && {
git pull origin master || errs="$errs$dir$nl";
}
popd;
} || git branch | grep '^\* .*' | cut -c 3-;
done
[[ "$errs" ]] && echo -ne "Errors:$nl$errs";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment