Skip to content

Instantly share code, notes, and snippets.

@robolson
Created March 7, 2009 21:39
Show Gist options
  • Star 16 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save robolson/75456 to your computer and use it in GitHub Desktop.
Save robolson/75456 to your computer and use it in GitHub Desktop.
Shell script to check multiple git repositories for updates.
#!/bin/bash
repos=(
"/Users/rob/Library/Application Support/TextMate/Bundles/Git.tmbundle"
"/Users/rob/Library/Application Support/TextMate/Bundles/Ruby.tmbundle"
"/Users/rob/Library/Application Support/TextMate/Bundles/RubyAMP.tmbundle"
"/Users/rob/Library/Application Support/TextMate/Bundles/Ruby Haml.tmbundle"
"/Users/rob/Library/Application Support/TextMate/Bundles/Ruby on Rails.tmbundle"
"/Users/rob/Library/Application Support/TextMate/Bundles/ruby-sass.tmbundle"
"/Users/rob/Library/Application Support/TextMate/Bundles/ruby-shoulda.tmbundle"
)
echo "Checking" ${#repos[@]} "repositories for updates"
for repo in "${repos[@]}"
do
echo "updating" ${repo}
cd "${repo}"
git pull
done
@pangteypiyush
Copy link

rather than adding entries to $repos manually, you can try "for dir in $(find . -name ".git")" .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment