I'm thinking about setting up a cronjob for fetching all my repositories every once in a while, to have the current status ready in case I'm offline. Something like the following (wrapped for better readability):
find $HOME -name .git -type d -printf "%h\0" |
parallel --gnu -0 --delay 0.2 --jobs 100 --progress \
'cd {}; git fetch --all --quiet'
I don't really care what happens if the fetch fails -- it might succeed the next time. Perhaps error output could be logged. My questions are:
- What if the background process fetches into a Git repository while I'm committing to it?
- Can you recommend other switches to
parallel
to make this really fail-safe?
.git/index.lock
. But I don't think the lock file is created when using fetch. Probably becausefetch --all
is harmless and doesn't do any modification to your local tree whatsoever.