{
  "schemaVersion": "0.11.0",
  "canonical": "https://www.pystone.net/notes/git-sparse-checkout-config-reference/",
  "atlas": "https://www.pystone.net/?node=git-sparse-checkout-config-reference#knowledge-atlas",
  "markdown": "https://www.pystone.net/notes/git-sparse-checkout-config-reference.md",
  "context": "https://www.pystone.net/notes/git-sparse-checkout-config-reference.context.json",
  "knowledgeVersion": "224c990773de.5fa8af6e39fa",
  "build": {
    "siteCommit": "224c990773de166d23a886306577dd90379529ce",
    "notesCommit": "5fa8af6e39fa3891d1b9b4832bfa6c4e0ecaaf0a",
    "builtAt": "1970-01-01T00:00:00.000Z",
    "version": "224c990773de.5fa8af6e39fa"
  },
  "id": "note:git-sparse-checkout-config-reference",
  "slug": "git-sparse-checkout-config-reference",
  "title": "Git 并行检出配置官方资料摘录",
  "type": "note",
  "visibility": "public",
  "idStability": "rename-stable",
  "author": {
    "name": "Perrin Yong",
    "profile": "https://www.pystone.net/profile/"
  },
  "publisher": {
    "name": "Perrin Yong",
    "profile": "https://www.pystone.net/profile/"
  },
  "aliases": [],
  "summary": "Git 并行检出配置官方资料摘录",
  "contentRole": "unspecified",
  "isMoc": false,
  "mocRecognition": "none",
  "generated": false,
  "attribution": "unspecified",
  "domain": "99-资料来源、摘录与归档",
  "tags": [],
  "mocs": [],
  "contentHash": "0297981ad2bc5af97e0aa7bf4c805722a7f227efa684fae706f28e751d5e9f5a",
  "assets": [],
  "headings": [
    {
      "depth": 1,
      "text": "Git 并行检出配置官方资料摘录",
      "anchor": "git-并行检出配置官方资料摘录",
      "citation": "https://www.pystone.net/notes/git-sparse-checkout-config-reference/#git-%E5%B9%B6%E8%A1%8C%E6%A3%80%E5%87%BA%E9%85%8D%E7%BD%AE%E5%AE%98%E6%96%B9%E8%B5%84%E6%96%99%E6%91%98%E5%BD%95"
    },
    {
      "depth": 2,
      "text": "来源",
      "anchor": "来源",
      "citation": "https://www.pystone.net/notes/git-sparse-checkout-config-reference/#%E6%9D%A5%E6%BA%90"
    },
    {
      "depth": 2,
      "text": "两个配置项分别控制什么",
      "anchor": "两个配置项分别控制什么",
      "citation": "https://www.pystone.net/notes/git-sparse-checkout-config-reference/#%E4%B8%A4%E4%B8%AA%E9%85%8D%E7%BD%AE%E9%A1%B9%E5%88%86%E5%88%AB%E6%8E%A7%E5%88%B6%E4%BB%80%E4%B9%88"
    },
    {
      "depth": 2,
      "text": "官方给出的适用边界",
      "anchor": "官方给出的适用边界",
      "citation": "https://www.pystone.net/notes/git-sparse-checkout-config-reference/#%E5%AE%98%E6%96%B9%E7%BB%99%E5%87%BA%E7%9A%84%E9%80%82%E7%94%A8%E8%BE%B9%E7%95%8C"
    },
    {
      "depth": 2,
      "text": "对当前知识库的适用结论",
      "anchor": "对当前知识库的适用结论",
      "citation": "https://www.pystone.net/notes/git-sparse-checkout-config-reference/#%E5%AF%B9%E5%BD%93%E5%89%8D%E7%9F%A5%E8%AF%86%E5%BA%93%E7%9A%84%E9%80%82%E7%94%A8%E7%BB%93%E8%AE%BA"
    }
  ],
  "claims": [],
  "outgoing": [
    {
      "id": "note:performance-optimization-cost-frequency-scope",
      "title": "性能优化的本质是控制成本发生的频率、时机与范围",
      "url": "https://www.pystone.net/notes/performance-optimization-cost-frequency-scope/",
      "atlas": "https://www.pystone.net/?node=performance-optimization-cost-frequency-scope#knowledge-atlas",
      "label": "性能优化的本质是控制成本发生的频率、时机与范围",
      "origin": "explicit",
      "humanReviewed": true,
      "context": "本库实测结果及其证据边界记录在性能优化的本质是控制成本发生的频率、时机与范围。官方文档支持配置含义和边界，本地对照支持当前环境中的效果；二者不能互相替代。",
      "citation": "https://www.pystone.net/notes/git-sparse-checkout-config-reference/#%E5%AF%B9%E5%BD%93%E5%89%8D%E7%9F%A5%E8%AF%86%E5%BA%93%E7%9A%84%E9%80%82%E7%94%A8%E7%BB%93%E8%AE%BA"
    }
  ],
  "incoming": [
    {
      "id": "note:performance-optimization-cost-frequency-scope",
      "title": "性能优化的本质是控制成本发生的频率、时机与范围",
      "url": "https://www.pystone.net/notes/performance-optimization-cost-frequency-scope/",
      "atlas": "https://www.pystone.net/?node=performance-optimization-cost-frequency-scope#knowledge-atlas",
      "label": "性能优化的本质是控制成本发生的频率、时机与范围",
      "origin": "explicit",
      "humanReviewed": true,
      "context": "Git 并行检出配置官方资料说明， 默认为 1，小于 1 时使用可用逻辑核心， 控制值得启动并行处理的最小文件数。保持 index、临时 worktree、审批记录、validator 范围和失败语义不变，只让物化命令使用 与阈值 100 后，同一次剖析中的 checkout 降为 401.9 ms，validator 保持 942.1 ms，整条路径降为 ",
      "citation": "https://www.pystone.net/notes/performance-optimization-cost-frequency-scope/#%E5%BD%A2%E6%88%90%E5%90%8E%E5%B7%A5%E7%A8%8B%E6%A0%A1%E5%87%86%E5%85%AC%E5%BC%80%E4%BB%93%E5%BA%93-staged-snapshot-%E5%85%B3%E9%94%AE%E8%B7%AF%E5%BE%84"
    },
    {
      "id": "note:sources-excerpts-archive",
      "title": "资料来源、摘录与归档",
      "url": "https://www.pystone.net/notes/sources-excerpts-archive/",
      "atlas": "https://www.pystone.net/?node=sources-excerpts-archive#knowledge-atlas",
      "label": "资料来源、摘录与归档",
      "origin": "explicit",
      "humanReviewed": true,
      "context": "01-外部文章与转载摘录中的“Git 并行检出配置官方资料摘录”导航项",
      "citation": "https://www.pystone.net/notes/sources-excerpts-archive/#01-%E5%A4%96%E9%83%A8%E6%96%87%E7%AB%A0%E4%B8%8E%E8%BD%AC%E8%BD%BD%E6%91%98%E5%BD%95"
    }
  ],
  "contentMarkdown": "# Git 并行检出配置官方资料摘录\n\n> [!source] 来源摘录\n> 本文摘录 Git 官方 `git-config` 文档中与工作树并行检出有关的配置语义。官方资料说明能力、默认值和适用条件；本知识库中的具体耗时与收益仍属于本地测量，不能反向当作 Git 的普遍性能承诺。\n\n## 来源\n\n- Git Documentation：[*git-config*](https://git-scm.com/docs/git-config)，条目 `checkout.workers` 与 `checkout.thresholdForParallelism`\n- 核对版本：在线文档显示 2.55.0，2026-06-29 更新\n- 核对日期：2026-07-23\n\n## 两个配置项分别控制什么\n\n`checkout.workers` 控制更新工作树时使用的并行 worker 数量。默认值为 1，即顺序执行；设置为小于 1 的值时，Git 使用与可用逻辑核心数相当的 worker。该配置与并行阈值会影响执行 checkout 的多种命令，包括 checkout、clone、reset 和 sparse-checkout 等，而不只影响 `git checkout` 这一条命令。\n\n`checkout.thresholdForParallelism` 控制尝试并行检出的最小文件数量，默认值为 100。文件较少时，创建子进程和进程间通信的成本可能超过并行收益，所以阈值表达的是“何时值得启动并行”，不是另一种 worker 数量。\n\n## 官方给出的适用边界\n\nGit 文档指出，并行检出通常更可能在 SSD 或 NFS 上获得较好表现；在机械硬盘或核心数较少的机器上，默认的顺序检出往往更合适。仓库规模与压缩程度也会影响收益。因此不能只根据“存在并行选项”就断言它必然更快，更不能把某台机器上的加速比例外推为通用常数。\n\n## 对当前知识库的适用结论\n\n本库的暂存快照校验需要把 Git index 物化到临时工作树。保持 index、审批记录、validator 范围和失败语义不变，只调整物化阶段的 worker 与阈值，属于在同一语义边界内优化局部成本。它是否值得启用，应通过相同仓库、相同快照和相同校验路径的顺序/并行对照来判断。\n\n本库实测结果及其证据边界记录在[[10-计算机、信息技术与工程/05-游戏图形与运行时/游戏性能优化/性能优化的本质是控制成本发生的频率、时机与范围|性能优化的本质是控制成本发生的频率、时机与范围]]。官方文档支持配置含义和边界，本地对照支持当前环境中的效果；二者不能互相替代。\n"
}
