I have a lot of remotes added in my git. Each remote is a link to a network share folder of different regions, and each remote contains the code submitted by one developer.
Everyday I need to fetch the latest code they submitted by git fetch --all.
Because of the geographical location, the speed of the network share folders are different. Some of them are very very slow. I want to fetch the data from the fastest share folder first so that I can start examining code while waiting for the fetching of other remotes.
The order of fetch by git fetch --all is not the same as the one shown by git remote -v. How is the order of fetching determined and is there a way to control the order?
git config remotes.default "faster slower"
Then subsequent git remote update
, or git fetch --all
, will always update the remotes in the specified order, i.e., first faster
, then slower
.
It's remotes
, with an ending 's'
.
Here default
is the group name, other names are OK, but then need to be specified, like git remote update <group>
. default
happens to be the default group name if not specified.
Alternatively, in the early implementation, as git fetch --all
(used also by git remote update
) processes remotes in the order they appear in .git/config
, thus you can change the order in .git/config
to do the trick. But this is not part of the API, therefore could be broken when the implementation detail changes, as @chwarr has pointed out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With