summaryrefslogtreecommitdiff
path: root/devdocs/git/git-commit-graph.html
blob: 4cc60e3812724a0da6af994f3877d531319563e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
<h1>git-commit-graph</h1>  <h2 id="_name">Name</h2> <div class="sectionbody">  <p>git-commit-graph - Write and verify Git commit-graph files</p>  </div>   <h2 id="_synopsis">Synopsis</h2> <div class="sectionbody"> <div class="verseblock"> <pre class="content" data-language="shell">git commit-graph verify [--object-dir &lt;dir&gt;] [--shallow] [--[no-]progress]
git commit-graph write [--object-dir &lt;dir&gt;] [--append]
                        [--split[=&lt;strategy&gt;]] [--reachable | --stdin-packs | --stdin-commits]
                        [--changed-paths] [--[no-]max-new-filters &lt;n&gt;] [--[no-]progress]
                        &lt;split options&gt;</pre> </div> </div>   <h2 id="_description">Description</h2> <div class="sectionbody">  <p>Manage the serialized commit-graph file.</p>  </div>   <h2 id="_options">Options</h2> <div class="sectionbody"> <div class="dlist"> <dl> <dt class="hdlist1" id="Documentation/git-commit-graph.txt---object-dir"> --object-dir </dt> <dd> <p>Use given directory for the location of packfiles and commit-graph file. This parameter exists to specify the location of an alternate that only has the objects directory, not a full <code>.git</code> directory. The commit-graph file is expected to be in the <code>&lt;dir&gt;/info</code> directory and the packfiles are expected to be in <code>&lt;dir&gt;/pack</code>. If the directory could not be made into an absolute path, or does not match any known object directory, <code>git commit-graph ...</code> will exit with non-zero status.</p> </dd> <dt class="hdlist1" id="Documentation/git-commit-graph.txt---no-progress"> --[no-]progress </dt> <dd> <p>Turn progress on/off explicitly. If neither is specified, progress is shown if standard error is connected to a terminal.</p> </dd> </dl> </div> </div>   <h2 id="_commands">Commands</h2> <div class="sectionbody"> <div class="dlist"> <dl> <dt class="hdlist1" id="Documentation/git-commit-graph.txt-emwriteem"> <em>write</em> </dt> <dd> <p>Write a commit-graph file based on the commits found in packfiles. If the config option <code>core.commitGraph</code> is disabled, then this command will output a warning, then return success without writing a commit-graph file.</p>  <p>With the <code>--stdin-packs</code> option, generate the new commit graph by walking objects only in the specified pack-indexes. (Cannot be combined with <code>--stdin-commits</code> or <code>--reachable</code>.)</p>   <p>With the <code>--stdin-commits</code> option, generate the new commit graph by walking commits starting at the commits specified in stdin as a list of OIDs in hex, one OID per line. OIDs that resolve to non-commits (either directly, or by peeling tags) are silently ignored. OIDs that are malformed, or do not exist generate an error. (Cannot be combined with <code>--stdin-packs</code> or <code>--reachable</code>.)</p>   <p>With the <code>--reachable</code> option, generate the new commit graph by walking commits starting at all refs. (Cannot be combined with <code>--stdin-commits</code> or <code>--stdin-packs</code>.)</p>   <p>With the <code>--append</code> option, include all commits that are present in the existing commit-graph file.</p>   <p>With the <code>--changed-paths</code> option, compute and write information about the paths changed between a commit and its first parent. This operation can take a while on large repositories. It provides significant performance gains for getting history of a directory or a file with <code>git log -- &lt;path&gt;</code>. If this option is given, future commit-graph writes will automatically assume that this option was intended. Use <code>--no-changed-paths</code> to stop storing this data.</p>   <p>With the <code>--max-new-filters=&lt;n&gt;</code> option, generate at most <code>n</code> new Bloom filters (if <code>--changed-paths</code> is specified). If <code>n</code> is <code>-1</code>, no limit is enforced. Only commits present in the new layer count against this limit. To retroactively compute Bloom filters over earlier layers, it is advised to use <code>--split=replace</code>. Overrides the <code>commitGraph.maxNewFilters</code> configuration.</p>   <p>With the <code>--split[=&lt;strategy&gt;]</code> option, write the commit-graph as a chain of multiple commit-graph files stored in <code>&lt;dir&gt;/info/commit-graphs</code>. Commit-graph layers are merged based on the strategy and other splitting options. The new commits not already in the commit-graph are added in a new "tip" file. This file is merged with the existing file if the following merge conditions are met:</p>  <div class="ulist"> <ul> <li> <p>If <code>--split=no-merge</code> is specified, a merge is never performed, and the remaining options are ignored. <code>--split=replace</code> overwrites the existing chain with a new one. A bare <code>--split</code> defers to the remaining options. (Note that merging a chain of commit graphs replaces the existing chain with a length-1 chain where the first and only incremental holds the entire graph).</p> </li> <li> <p>If <code>--size-multiple=&lt;X&gt;</code> is not specified, let <code>X</code> equal 2. If the new tip file would have <code>N</code> commits and the previous tip has <code>M</code> commits and <code>X</code> times <code>N</code> is greater than <code>M</code>, instead merge the two files into a single file.</p> </li> <li> <p>If <code>--max-commits=&lt;M&gt;</code> is specified with <code>M</code> a positive integer, and the new tip file would have more than <code>M</code> commits, then instead merge the new tip with the previous tip.</p>  <p>Finally, if <code>--expire-time=&lt;datetime&gt;</code> is not specified, let <code>datetime</code> be the current time. After writing the split commit-graph, delete all unused commit-graph whose modified times are older than <code>datetime</code>.</p>  </li> </ul> </div> </dd> <dt class="hdlist1" id="Documentation/git-commit-graph.txt-emverifyem"> <em>verify</em> </dt> <dd> <p>Read the commit-graph file and verify its contents against the object database. Used to check for corrupted data.</p>  <p>With the <code>--shallow</code> option, only check the tip commit-graph file in a chain of split commit-graphs.</p>  </dd> </dl> </div> </div>   <h2 id="_examples">Examples</h2> <div class="sectionbody"> <div class="ulist"> <ul> <li> <p>Write a commit-graph file for the packed commits in your local <code>.git</code> directory.</p> <div class="listingblock"> <div class="content"> <pre data-language="shell-session">$ git commit-graph write</pre> </div> </div> </li> <li> <p>Write a commit-graph file, extending the current commit-graph file using commits in <code>&lt;pack-index&gt;</code>.</p> <div class="listingblock"> <div class="content"> <pre data-language="shell-session">$ echo &lt;pack-index&gt; | git commit-graph write --stdin-packs</pre> </div> </div> </li> <li> <p>Write a commit-graph file containing all reachable commits.</p> <div class="listingblock"> <div class="content"> <pre data-language="shell-session">$ git show-ref -s | git commit-graph write --stdin-commits</pre> </div> </div> </li> <li> <p>Write a commit-graph file containing all commits in the current commit-graph file along with those reachable from <code>HEAD</code>.</p> <div class="listingblock"> <div class="content"> <pre data-language="shell-session">$ git rev-parse HEAD | git commit-graph write --stdin-commits --append</pre> </div> </div> </li> </ul> </div> </div>   <h2 id="_configuration">Configuration</h2> <div class="sectionbody">  <p>Everything below this line in this section is selectively included from the <a href="git-config">git-config[1]</a> documentation. The content is the same as what’s found there:</p>  <div class="dlist"> <dl> <dt class="hdlist1" id="Documentation/git-commit-graph.txt-commitGraphgenerationVersion"> commitGraph.generationVersion </dt> <dd> <p>Specifies the type of generation number version to use when writing or reading the commit-graph file. If version 1 is specified, then the corrected commit dates will not be written or read. Defaults to 2.</p> </dd> <dt class="hdlist1" id="Documentation/git-commit-graph.txt-commitGraphmaxNewFilters"> commitGraph.maxNewFilters </dt> <dd> <p>Specifies the default value for the <code>--max-new-filters</code> option of <code>git
commit-graph write</code> (c.f., <a href="git-commit-graph">git-commit-graph[1]</a>).</p> </dd> <dt class="hdlist1" id="Documentation/git-commit-graph.txt-commitGraphreadChangedPaths"> commitGraph.readChangedPaths </dt> <dd> <p>If true, then git will use the changed-path Bloom filters in the commit-graph file (if it exists, and they are present). Defaults to true. See <a href="git-commit-graph">git-commit-graph[1]</a> for more information.</p> </dd> </dl> </div> </div>   <h2 id="_file_format">File format</h2> <div class="sectionbody">  <p>see <a href="gitformat-commit-graph">gitformat-commit-graph[5]</a>.</p>  </div><div class="_attribution">
  <p class="_attribution-p">
    &copy; 2012&ndash;2024 Scott Chacon and others<br>Licensed under the MIT License.<br>
    <a href="https://git-scm.com/docs/git-commit-graph" class="_attribution-link">https://git-scm.com/docs/git-commit-graph</a>
  </p>
</div>