Skip to content

Instantly share code, notes, and snippets.

@pkqk
Last active August 29, 2015 14:17
Show Gist options
  • Save pkqk/e5622d7b29ab17ee731f to your computer and use it in GitHub Desktop.
Save pkqk/e5622d7b29ab17ee731f to your computer and use it in GitHub Desktop.
pull all the repos
# for each match that is a directory with a git repo in it
for dir in */.git
do
# change into directory
# dirname gets rid of the .git
# quotes around $dir in case a name with spaces comes along
pushd `dirname "$dir"`
# fetch new updates
# but only pull them into your branch if you haven't changed anything
git fetch && git pull --ff-only
# change back to previous directory
popd
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment