从文档中,https://git-scm.com/docs/git-remote#Documentation/git-remote.txt-emset-branchesem,我不清楚它到底做了什么。
这是2010年5月在Git v1.7.2-rc0中引入的,提交3d8b694并注释:
添加git远程集分支
添加"
git remote set-branches
"以更改跟踪引用的列表对于具有一个"远程存储库"的远程存储库;瓷水准仪;命令
此补充了长期存在的"git remote add --track
"选项。该接口基于"git remote set url"子命令。
git remote set-branches base --add C git remote set-branches base A B D git remote set-branches base --delete D; # not implemented
因此,远程跟踪refs/remotes/<name>/
命名空间下所有分支的默认glob refspec不是更新refspec以仅跟踪<branch>
git remote add -t main o2 https://github.com/git/git
会给出:
[remote "o2"]
url = https://github.com/git/git
fetch = +refs/heads/main:refs/remotes/o2/main
代替:
fetch = +refs/heads/*:refs/remotes/origin/*
添加一个分支将是:
git remote set-branches o2 --add master
[remote "o2"]
url = https://github.com/git/git
fetch = +refs/heads/main:refs/remotes/o2/main
fetch = +refs/heads/main:refs/remotes/o2/master