Von*_*onC 5

这是在 2010 年 5 月随 Git v1.7.2-rc0 引入的,提交 3d8b694并添加注释:

\n
\n

添加 git 远程设置分支

\n

添加 \xe2\x80\x98 git remote set-branches\xe2\x80\x99 以使用一个“瓷器级”命令更改远程存储库的跟踪引用列表。
\n这\n补充了长期存在的 \xe2\x80\x98 git remote add --track\xe2\x80\x99 选项。

\n

该界面基于 \xe2\x80\x98git Remote set-url\xe2\x80\x99 子命令。

\n
git remote set-branches base --add C\ngit remote set-branches base A B D\ngit remote set-branches base --delete D; # not implemented\n
Run Code Online (Sandbox Code Playgroud)\n
\n

因此,不是使用默认的全局引用规范来跟踪refs/remotes/<name>/命名空间下的所有分支,而是更新引用规范以仅跟踪<branch>

\n
git remote add -t main o2 https://github.com/git/git\n
Run Code Online (Sandbox Code Playgroud)\n

会给出:

\n
[remote "o2"]\n        url = https://github.com/git/git\n        fetch = +refs/heads/main:refs/remotes/o2/main\n
Run Code Online (Sandbox Code Playgroud)\n

代替:

\n
    fetch = +refs/heads/*:refs/remotes/origin/*\n
Run Code Online (Sandbox Code Playgroud)\n

添加分支将是:

\n
   git remote set-branches o2 --add master\n[remote "o2"]\n        url = https://github.com/git/git\n        fetch = +refs/heads/main:refs/remotes/o2/main\n        fetch = +refs/heads/main:refs/remotes/o2/master\n
Run Code Online (Sandbox Code Playgroud)\n