Created
January 31, 2020 04:56
-
-
Save huangsam/f3daad52c364ac8848c9aee1ea8daf88 to your computer and use it in GitHub Desktop.
Recursively update Git repositories with a remote origin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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