設定和配置
獲取和建立專案
基本快照
分支與合併
共享和更新專案
檢查和比較
打補丁
除錯
電子郵件
外部系統
伺服器管理
指南
管理
底層命令
-
2.52.0
2025-11-17
- 2.46.1 → 2.51.2 無更改
-
2.46.0
2024-07-29
- 2.44.1 → 2.45.4 無更改
-
2.44.0
2024-02-23
- 2.39.1 → 2.43.7 無更改
-
2.39.0
2022-12-12
- 2.38.1 → 2.38.5 無更改
-
2.38.0
2022-10-02
- 2.30.1 → 2.37.7 無更改
-
2.30.0
2020-12-27
- 2.29.1 → 2.29.3 無更改
-
2.29.0
2020-10-19
- 2.28.1 無更改
-
2.28.0
2020-07-27
- 2.27.1 無更改
-
2.27.0
2020-06-01
- 2.26.1 → 2.26.3 無更改
-
2.26.0
2020-03-22
- 2.25.1 → 2.25.5 無更改
- 2.25.0 無更改
- 2.24.1 → 2.24.4 無更改
-
2.24.0
2019-11-04
- 2.23.1 → 2.23.4 無更改
-
2.23.0
2019-08-16
- 2.19.3 → 2.22.5 無更改
-
2.19.2
2018-11-21
- 2.19.1 無更改
-
2.19.0
2018-09-10
- 2.18.1 → 2.18.5 無更改
-
2.18.0
2018-06-21
概要
git commit-graph verify [--object-dir <dir>] [--shallow] [--[no-]progress] git commit-graph write [--object-dir <dir>] [--append] [--split[=<strategy>]] [--reachable | --stdin-packs | --stdin-commits] [--changed-paths] [--[no-]max-new-filters <n>] [--[no-]progress] <split-options>
命令
- write
-
根據 packfiles 中找到的提交寫入 commit-graph 檔案。如果配置選項
core.commitGraph被停用,則此命令將輸出一個警告,然後成功返回而不寫入 commit-graph 檔案。使用
--stdin-packs選項,透過遍歷指定 pack-indexes 中的物件來生成新的 commit graph。 (不能與--stdin-commits或--reachable結合使用。)使用
--stdin-commits選項,透過遍歷 stdin 中指定的提交(以十六進位制 OID 列表的形式,每行一個 OID)來生成新的 commit graph。解析為非提交物件的 OID(直接解析或透過剝離標籤)將被靜默忽略。格式錯誤或不存在的 OID 將導致錯誤。(不能與--stdin-packs或--reachable結合使用。)使用
--reachable選項,透過遍歷所有 ref 的提交來生成新的 commit graph。(不能與--stdin-commits或--stdin-packs結合使用。)使用
--append選項,包含現有 commit-graph 檔案中存在的所有提交。使用
--changed-paths選項,計算並寫入有關提交與其第一個父提交之間更改的路徑資訊。此操作在大倉庫上可能需要一些時間。它為使用gitlog--<path> 獲取目錄或檔案的歷史記錄提供了顯著的效能提升。如果提供了此選項,未來的 commit-graph 寫入將自動假定已指定此選項。使用--no-changed-paths停止儲存此資料。--changed-paths是透過配置commitGraph.changedPaths=true隱含的。使用
--max-new-filters=<n> 選項,生成最多n個新的 Bloom 過濾器(如果指定了--changed-paths)。如果n為-1,則不執行限制。只有新層中存在的提交才計入此限制。為了追溯性地計算早期層的 Bloom 過濾器,建議使用--split=replace。覆蓋commitGraph.maxNewFilters配置。使用
--split[=<strategy>] 選項,將 commit-graph 寫入為儲存在 <dir>/info/commit-graphs中的多個 commit-graph 檔案鏈。Commit-graph 層根據策略和其他拆分選項進行合併。新新增到 commit-graph 的提交將新增到一個新的“尖端”檔案中。如果滿足以下合併條件,則此檔案將與現有檔案合併。-
如果指定了
--split=no-merge,則永遠不會執行合併,並且將忽略其餘選項。--split=replace會用新的鏈覆蓋現有鏈。裸--split選項將按照其餘選項執行。(請注意,合併 commit graph 鏈會將現有鏈替換為長度為 1 的鏈,其中第一個也是唯一的增量持有整個圖)。 -
如果未指定
--size-multiple=<X>,則令X等於 2。如果新的尖端檔案包含N個提交,而前一個尖端檔案包含M個提交,並且X乘以N大於M,則將這兩個檔案合併為一個檔案。 -
如果指定了
--max-commits=<M> 且M為正整數,並且新的尖端檔案將包含超過M個提交,則將新的尖端與前一個尖端合併。最後,如果未指定
--expire-time=<datetime>,則令datetime為當前時間。寫入拆分的 commit-graph 後,刪除所有修改時間早於datetime的未使用的 commit-graph。
-
- verify
-
讀取 commit-graph 檔案並將其內容與物件資料庫進行驗證。用於檢查損壞的資料。
使用
--shallow選項,僅檢查已拆分 commit-graph 鏈中的尖端 commit-graph 檔案。
示例
-
為本地
.git目錄中的已打包提交寫入 commit-graph 檔案。$ git commit-graph write
-
寫入 commit-graph 檔案,使用 <pack-index> 中的提交擴充套件當前的 commit-graph 檔案。
$ echo <pack-index> | git commit-graph write --stdin-packs
-
寫入一個包含所有可達提交的 commit-graph 檔案。
$ git show-ref -s | git commit-graph write --stdin-commits
-
寫入一個 commit-graph 檔案,該檔案包含當前 commit-graph 檔案中的所有提交以及從
HEAD可達的提交。$ git rev-parse HEAD | git commit-graph write --stdin-commits --append
配置
本節中以下所有內容均從 git-config[1] 文件中選擇性地包含。內容與彼處相同:
- commitGraph.generationVersion
-
指定寫入或讀取 commit-graph 檔案時使用的生成號版本型別。如果指定版本 1,則不會寫入或讀取已更正的提交日期。預設為 2。
- commitGraph.maxNewFilters
-
指定
gitcommit-graphwrite的--max-new-filters選項的預設值(參見 git-commit-graph[1])。 - commitGraph.changedPaths
-
如果為 true,則
gitcommit-graphwrite將預設計算並寫入 changed-path Bloom 過濾器,相當於傳遞--changed-paths。如果為 false 或未設定,則僅當過濾器已存在於當前 commit-graph 檔案中時,在gitcommit-graphwrite期間寫入 changed-paths Bloom 過濾器。這與不帶任何--[no-]changed-paths選項的gitcommit-graphwrite的預設行為一致。要重寫沒有過濾器的 commit-graph 檔案,請使用--no-changed-paths選項。命令列選項--[no-]changed-paths始終優先於此配置。預設為未設定。 - commitGraph.readChangedPaths
-
已棄用。如果為 true,則等同於 commitGraph.changedPathsVersion=-1;如果為 false,則等同於 commitGraph.changedPathsVersion=0。(如果 commitGraph.changedPathVersion 也已設定,則 commitGraph.changedPathsVersion 優先。)
- commitGraph.changedPathsVersion
-
指定 Git 將讀取和寫入的 changed-path Bloom 過濾器的版本。可以是 -1、0、1 或 2。請注意,大於 1 的值可能與不支援這些版本的舊版本 Git 不相容。在混合版本環境中操作時請小心。
預設為 -1。
如果為 -1,Git 將使用倉庫中 changed-path Bloom 過濾器的版本,如果不存在則預設為 1。
如果為 0,Git 不會讀取任何 Bloom 過濾器,並且在指示寫入時將寫入版本 1 的 Bloom 過濾器。
如果為 1,Git 只會讀取版本 1 的 Bloom 過濾器,並且會寫入版本 1 的 Bloom 過濾器。
如果為 2,Git 只會讀取版本 2 的 Bloom 過濾器,並且會寫入版本 2 的 Bloom 過濾器。
有關更多資訊,請參見 git-commit-graph[1]。