Git 配置文件中的 fetch 和 branch 有什么区别

What is the Difference Between fetch and branch in the Git config file

Git 存储库的 config 文件在 [git-svn remotes] 下有 fetchbranch 路径。配置文件甚至可以有多个 fetch 行和多个 branch 行。 fetchbranch 的原因是什么(两者之间有什么区别)?当我执行 git svn fetch --all 时,我会在 fetch 中以及所有其他 branch 行中获取主干的更新。所以看起来没有区别。如果我只使用多个 branch 列出我的所有分支并且没有 any fetch 行,有什么缺点吗?

[svn-remote "messy-repo"]
    url = http://server.org/svn
    fetch = trunk/project-a:refs/remotes/project-a/trunk
    fetch = branches/demos/june-project-a-demo:refs/remotes/project-a/demos/june-demo
    branches = branches/server/*:refs/remotes/project-a/branches/*
    branches = branches/demos/2011/*:refs/remotes/project-a/2011-demos/*

illustrated here 一样,第一个 git svn 克隆确实生成了一个包含 fetch 的配置。

If at any point after this you want to checkout additional branches, you first need to add it on your configuration file:

[svn-remote "svn"]
  url = https://example.com/
  fetch = PROJECT/branches/somefeature:refs/remotes/trunk
       branches = PROJECT/branches/{anotherfeature}:refs/remotes/*

The branches config always needs a glob.

来自git svn clone

After a repository is cloned, the fetch command will be able to update revisions without affecting the working tree

区别:

It is similar the core Git [remote] sections except fetch keys do not accept glob arguments; but they are instead handled by the branches and tags keys.