Last active
November 11, 2015 19:01
-
-
Save aelindeman/93e35fe09cd98523f39a to your computer and use it in GitHub Desktop.
run 'git fetch' for all repositories in a folder
This file contains 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
#!/usr/bin/env sh | |
# Alex Lindeman | |
# 2015-11-11 | |
# Runs 'git fetch' for all repositories in a folder. | |
target_folder="/srv/git" | |
git_opts="--prune --no-recurse-submodules" | |
GIT_DISCOVERY_ACROSS_FILESYSTEM=1 | |
git_bin=$(which git) | |
[ $? -eq 0 ] || (echo >&2 'git not installed or not in $PATH' && exit 1) | |
for repo in $target_folder/*; do | |
if [ -d "$repo" ]; then | |
$git_bin fetch $git_opts -- "$repo" | |
fi | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment