I personally have cloned hundreds of git repositories of various FOSS and FLOSS projects (for personal needs), and these, of course, should preferably have the latest changes available.
Doing manual git pull commands in each repository separately is insane, and my first effort to automate it proven to be to slow (one pull per repo at a time).
Started researching ways to speed this up in a sane manner, and found GNU parallel.
Fits the usecase nicely, and so, i started to experiment with it, to see, if it is up to the task practically.
Proven to offer what i need, the same Bash script was rewritten by using parallel in combination with find.
Damn thing ended up being much faster then expected and the git repositories were updated in minutes instead of nearly more then 15 minutes. This was done on a NVME SSD (works OK on a HDD, but don't expect a near x10 speedup).
For anyone interested in the script, here it is:
#!/usr/bin/env bash
NUMBER_OF_PROCESSES_TO_USE=4
echo 'Seeking the git repos within this directory...'
LOCAL_GIT_REPOS=$(find -type d -name '.git' -exec dirname {} ';')
NUMBER_OF_GIT_REPOS=$(echo "${LOCAL_GIT_REPOS}" | wc --lines)
echo "Starting to pull the latest remote changes for ${NUMBER_OF_GIT_REPOS} git repositories (see 'jobs completed' for the current progress)."
echo "${LOCAL_GIT_REPOS}" | \
parallel -j "${NUMBER_OF_PROCESSES_TO_USE}" --progress \
"git -C {} pull --all --recurse-submodules &> /dev/null"
It basically searches from the current working directory the git repositories, that are stored in it, and stores their filepaths (newline delimited) in a Bash variable.
Then, those filepaths get feed to parallel, which executes the git pull command with some additional parameters.
Not very complicated, but it took some time to get it to run reliably, since i didn't fully understand parallel yet.
Hope this helps anyone who is working on something similar.