How to control the sampling order when extracting all remotes on git fetch --all

There are a lot of remotes added in my git. Each console is a link to a shared folder in different regions, and each console contains a code submitted by one developer.

Every day I need to get the last code they sent to git fetch --all.

Due to the geographical location, the speed of shared folders on the network is different. Some of them are very slow. First, I want to get data from the fastest shared folder to start learning the code, waiting for a selection of other remotes.

The sampling order of git fetch --all does not match the sampling order with git remote -v. How is the sampling order determined and is there a way to control the order?

+6
source share
2 answers

This is just the order they appear in .git/config . This is just a text file, I edit it all the time.

+4
source
 git config remotes.default "faster slower" 

Then the subsequent git remote update or git fetch --all will always update the remotes in the specified order, that is, first faster , then slower .

Note:

  • These are remotes , with the ending 's' .

  • Here default is the name of the group, other names are in order, but then you need to specify, for example, git remote update <group> . default is the name of the default group, if not specified.

Alternatively, at the beginning of the implementation, since git fetch --all (also used by git remote update ) processes the remotes in the order in which they appear in .git/config , so you can change the order in .git/config to do trick. But this is not part of the API, so it can be broken when changing the implementation details, as @chwarr pointed out .

+5
source

Source: https://habr.com/ru/post/976755/


All Articles