summaryrefslogtreecommitdiffstats
path: root/git-update-index.html
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-03-09 14:19:31 -0800
committerJunio C Hamano <gitster@pobox.com>2022-03-09 14:19:31 -0800
commit7c37da749fa2c8d767b9ddfc2ed43986eb2f4d7c (patch)
tree217db038da87f53d7f6483aead1f09299d8a02e4 /git-update-index.html
parentc7a8d87b7ec3976798edbadec4c209e77b38c7c6 (diff)
downloadgit-htmldocs-7c37da749fa2c8d767b9ddfc2ed43986eb2f4d7c.tar.gz
Autogenerated HTML docs for v2.35.1-455-g1a487
Diffstat (limited to 'git-update-index.html')
-rw-r--r--git-update-index.html54
1 files changed, 40 insertions, 14 deletions
diff --git a/git-update-index.html b/git-update-index.html
index 40151135d..7ffba9575 100644
--- a/git-update-index.html
+++ b/git-update-index.html
@@ -1259,6 +1259,9 @@ unchanged". Note that "assume unchanged" bit is <strong>not</strong> set if
<code>git update-index --refresh</code> finds the working tree file matches
the index (use <code>git update-index --really-refresh</code> if you want
to mark them as "assume unchanged").</p></div>
+<div class="paragraph"><p>Sometimes users confuse the assume-unchanged bit with the
+skip-worktree bit. See the final paragraph in the "Skip-worktree bit"
+section below for an explanation of the differences.</p></div>
</div>
</div>
<div class="sect1">
@@ -1344,20 +1347,43 @@ now it checks with lstat(2) and finds it has been changed.
<div class="sect1">
<h2 id="_skip_worktree_bit">SKIP-WORKTREE BIT</h2>
<div class="sectionbody">
-<div class="paragraph"><p>Skip-worktree bit can be defined in one (long) sentence: When reading
-an entry, if it is marked as skip-worktree, then Git pretends its
-working directory version is up to date and read the index version
-instead.</p></div>
-<div class="paragraph"><p>To elaborate, "reading" means checking for file existence, reading
-file attributes or file content. The working directory version may be
-present or absent. If present, its content may match against the index
-version or not. Writing is not affected by this bit, content safety
-is still first priority. Note that Git <em>can</em> update working directory
-file, that is marked skip-worktree, if it is safe to do so (i.e.
-working directory version matches index version)</p></div>
+<div class="paragraph"><p>Skip-worktree bit can be defined in one (long) sentence: Tell git to
+avoid writing the file to the working directory when reasonably
+possible, and treat the file as unchanged when it is not
+present in the working directory.</p></div>
+<div class="paragraph"><p>Note that not all git commands will pay attention to this bit, and
+some only partially support it.</p></div>
+<div class="paragraph"><p>The update-index flags and the read-tree capabilities relating to the
+skip-worktree bit predated the introduction of the
+<a href="git-sparse-checkout.html">git-sparse-checkout(1)</a> command, which provides a much easier
+way to configure and handle the skip-worktree bits. If you want to
+reduce your working tree to only deal with a subset of the files in
+the repository, we strongly encourage the use of
+<a href="git-sparse-checkout.html">git-sparse-checkout(1)</a> in preference to the low-level
+update-index and read-tree primitives.</p></div>
+<div class="paragraph"><p>The primary purpose of the skip-worktree bit is to enable sparse
+checkouts, i.e. to have working directories with only a subset of
+paths present. When the skip-worktree bit is set, Git commands (such
+as <code>switch</code>, <code>pull</code>, <code>merge</code>) will avoid writing these files.
+However, these commands will sometimes write these files anyway in
+important cases such as conflicts during a merge or rebase. Git
+commands will also avoid treating the lack of such files as an
+intentional deletion; for example <code>git add -u</code> will not not stage a
+deletion for these files and <code>git commit -a</code> will not make a commit
+deleting them either.</p></div>
<div class="paragraph"><p>Although this bit looks similar to assume-unchanged bit, its goal is
-different from assume-unchanged bit&#8217;s. Skip-worktree also takes
-precedence over assume-unchanged bit when both are set.</p></div>
+different. The assume-unchanged bit is for leaving the file in the
+working tree but having Git omit checking it for changes and presuming
+that the file has not been changed (though if it can determine without
+stat&#8217;ing the file that it has changed, it is free to record the
+changes). skip-worktree tells Git to ignore the absence of the file,
+avoid updating it when possible with commands that normally update
+much of the working directory (e.g. <code>checkout</code>, <code>switch</code>, <code>pull</code>,
+etc.), and not have its absence be recorded in commits. Note that in
+sparse checkouts (setup by <code>git sparse-checkout</code> or by configuring
+core.sparseCheckout to true), if a file is marked as skip-worktree in
+the index but is found in the working tree, Git will clear the
+skip-worktree bit for that file.</p></div>
</div>
</div>
<div class="sect1">
@@ -1518,7 +1544,7 @@ automatically.</p></div>
<div id="footer">
<div id="footer-text">
Last updated
- 2021-01-25 18:03:13 PST
+ 2022-03-09 14:17:38 PST
</div>
</div>
</body>