Skip to content

Instantly share code, notes, and snippets.

@huangsam
Created January 31, 2020 04:56
Show Gist options
  • Save huangsam/f3daad52c364ac8848c9aee1ea8daf88 to your computer and use it in GitHub Desktop.
Save huangsam/f3daad52c364ac8848c9aee1ea8daf88 to your computer and use it in GitHub Desktop.
Recursively update Git repositories with a remote origin
# Run `git pull` for every repo under a path
function gpull() {
# shellcheck disable=SC2156
find "${1:-.}" -type d -name ".git" -exec bash -c '
cd {}/../
dir="$(pwd)"
if grep -qs "remote" .git/config; then
echo "= pull $dir"
git pull -q
else
echo "x skip $dir"
fi
' \;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment