Skip to content

Instantly share code, notes, and snippets.

@OndraZizka
Last active April 18, 2023 19:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OndraZizka/1fe1e958633c11a2880dab80c8ccb3b4 to your computer and use it in GitHub Desktop.
Save OndraZizka/1fe1e958633c11a2880dab80c8ccb3b4 to your computer and use it in GitHub Desktop.
Fetch all Git repos in subdirectories
#!/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