是否可以在git中配置仅在其名称正式请求时获取的遥控器?所以他们将被排除在像fetch --all
这样的行动之外。
想象一下名为“my-no-auto-fetch-remote”的休眠(禁用或其他)遥控器:
$ git fetch my-no-auto-fetch-remote
(它被取出)
$ git fetch --all
(不应该获取my-no-auto-fetch-remote)
不是真的,不是:--all
意味着所有。但您可以定义远程组,并使用git remote update
更新组。将通常不可用的遥控器放入不是默认组的组中。有关详细信息,请参阅the git remote
documentation。
(git fetch
也与团体合作,我更喜欢在处理团体时使用git remote
,而我自己也喜欢使用git fetch
作为一个个人遥控器。可能是十年以上的延续......)
有一个配置skipFetchAll
遥控器。
来自以下文档:https://git-scm.com/docs/git-config/1.9.2
remote..skipFetchAll
如果为true,则在使用git-fetch [1]或git-remote [1]的update子命令进行更新时,默认情况下将跳过此远程。
由于在添加或更改遥控器时命令行没有选项,我必须将该配置编辑为.git/config
文件,如下所示:
[remote "my-remote"]
url = git@the-repository-url
fetch = +refs/heads/*:refs/remotes/my-remote/*
skipFetchAll = true
我会用bash技巧做到这一点:
git remote | grep -v the-repo-i-dont-want | xargs git fetch
可能会把它变成脚本或git别名。