Last active
April 18, 2023 19:07
-
-
Save OndraZizka/1fe1e958633c11a2880dab80c8ccb3b4 to your computer and use it in GitHub Desktop.
Fetch all Git repos in subdirectories
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
#!/bin/bash | |
## Run this in a directory to fetch all Git repos within it. | |
find -name .git | sed 's#.git##' | sort | xargs -t -n1 -I % git -C % fetch --all | |
## CRON job: You can also put this into `crontab -e` in order to keep all repos up-to-date automatically: | |
# # m h DoM mth DoW command | |
# */5 * * * * find /home/ondra/work -name .git | sed 's#.git##' | sort | xargs -t -n1 -I % git -C % fetch --all --tags --force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment