* [PATCH v3] doc: update-index: update options and section formatting
2026-11-22 15:25 [PATCH] doc: update-index: Format options correctly Omri Sarig
2026-11-22 15:36 ` [PATCH v2] doc: update-index: format " Omri Sarig
2026-11-22 20:19 ` [PATCH] doc: update-index: Format " Junio C Hamano
@ 2026-11-29 18:40 ` Omri Sarig
2 siblings, 0 replies; 9+ messages in thread
From: Omri Sarig @ 2026-11-29 18:40 UTC (permalink / raw)
To: omri.sarig13; +Cc: git, gitster
Replace [verse] with [synopsis] in the SYNOPSIS block.
Backtick-quote all option terms in the OPTIONS section, and
convert single-quoted commands and tools in prose to
backtick form.
Create links to referred sections, and update the document
to use the links whenever referring to these sections.
Use "assume unchanged" and "skip-worktree" consistently
across the document, and always quoted.
Use tabs before option description consistently, never using
8 spaces.
Signed-off-by: Omri Sarig <omri.sarig13@gmail.com>
---
Changes in V3:
- The original patch was a small commit, targeting 4 missing formatting for
options. As per the review comments from Junio, V3 is quite bigger -
updating the formatting of the whole document, instead of only these few
options.
The work done in this patch is based on similar work done on other
documentation pages, mainly:
1. For the general formatting: 9a99ef2da (doc: convert git-format-patch
synopsis and options to new style, 2026-07-23) - as was recommended by
Junio.
2. For the inter-section linking: 2fc11e3382 (doc: add more AsciiDoc
cross-references, 2026-09-25)
- As part of this change, I've noticed that the "assume unchanged" and
"skip-worktree" references across the whole document were inconsistent -
sometimes they were in quotes, while other times not, sometimes they were
hyphened, while other times had spaces between them.
I've updated them to use the form that seemed to be the most used for each,
though, now they are not consistent with each other.
I also kept them with regular quotes (and not single quotes or backticks).
I'm not sure if this is the correct format for them. Let me know what is the
right thing here, I'll be happy to change accordingly.
Documentation/git-update-index.adoc | 240 ++++++++++++++--------------
1 file changed, 123 insertions(+), 117 deletions(-)
diff --git a/Documentation/git-update-index.adoc b/Documentation/git-update-index.adoc
index 9bea9fab9a..ecc10fb49f 100644
--- a/Documentation/git-update-index.adoc
+++ b/Documentation/git-update-index.adoc
@@ -8,8 +8,8 @@ git-update-index - Register file contents in the working tree to the index
SYNOPSIS
--------
-[verse]
-'git update-index'
+[synopsis]
+git update-index
[--add] [--remove | --force-remove] [--replace]
[--refresh] [-q] [--unmerged] [--ignore-missing]
[(--cacheinfo <mode>,<object>,<file>)...]
@@ -37,57 +37,57 @@ any 'unmerged' or 'needs updating' state is cleared.
See also linkgit:git-add[1] for a more user-friendly way to do some of
the most common operations on the index.
-The way 'git update-index' handles files it is told about can be modified
+The way `git update-index` handles files it is told about can be modified
using the various options:
OPTIONS
-------
---add::
+`--add`::
If a specified file isn't in the index already then it's
added.
Default behaviour is to ignore new files.
---remove::
+`--remove`::
If a specified file is in the index but is missing then it's
removed.
Default behavior is to ignore removed files.
---refresh::
+`--refresh`::
Looks at the current index and checks to see if merges or
- updates are needed by checking stat() information.
+ updates are needed by checking `stat()` information.
--q::
- Quiet. If --refresh finds that the index needs an update, the
- default behavior is to error out. This option makes
- 'git update-index' continue anyway.
+`-q`::
+ Quiet. If `--refresh` finds that the index needs an update, the
+ default behavior is to error out. This option makes
+ `git update-index` continue anyway.
---ignore-submodules::
+`--ignore-submodules`::
Do not try to update submodules. This option is only respected
- when passed before --refresh.
+ when passed before `--refresh`.
---unmerged::
- If --refresh finds unmerged changes in the index, the default
- behavior is to error out. This option makes 'git update-index'
- continue anyway.
+`--unmerged`::
+ If `--refresh` finds unmerged changes in the index, the default
+ behavior is to error out. This option makes `git update-index`
+ continue anyway.
---ignore-missing::
- Ignores missing files during a --refresh
+`--ignore-missing`::
+ Ignores missing files during a `--refresh`
---cacheinfo <mode>,<object>,<path>::
---cacheinfo <mode> <object> <path>::
+`--cacheinfo <mode>,<object>,<path>`::
+`--cacheinfo <mode> <object> <path>`::
Directly insert the specified info into the index. For
backward compatibility, you can also give these three
arguments as three separate parameters, but new users are
encouraged to use a single-parameter form.
---index-info::
- Read index information from stdin.
+`--index-info`::
+ Read index information from stdin.
---chmod=(+|-)x::
- Set the execute permissions on the updated files.
+`--chmod=(+|-)x`::
+ Set the execute permissions on the updated files.
---assume-unchanged::
---no-assume-unchanged::
+`--assume-unchanged`::
+`--no-assume-unchanged`::
When this flag is specified, the object names recorded
for the paths are not updated. Instead, this option
sets/unsets the "assume unchanged" bit for the
@@ -97,7 +97,7 @@ OPTIONS
the index. If you want to change the working tree file,
you need to unset the bit to tell Git. This is
sometimes helpful when working with a big project on a
- filesystem that has a very slow lstat(2) system call
+ filesystem that has a very slow `lstat`(2) system call
(e.g. cifs).
+
Git will fail (gracefully) in case it needs to modify this file
@@ -105,65 +105,67 @@ in the index e.g. when merging in a commit;
thus, in case the assumed-untracked file is changed upstream,
you will need to handle the situation manually.
---really-refresh::
+`--really-refresh`::
Like `--refresh`, but checks stat information unconditionally,
without regard to the "assume unchanged" setting.
---skip-worktree::
---no-skip-worktree::
+`--skip-worktree`::
+`--no-skip-worktree`::
When one of these flags is specified, the object names recorded
for the paths are not updated. Instead, these options
set and unset the "skip-worktree" bit for the paths. See
- section "Skip-worktree bit" below for more information.
+ section <<SKIP_WORKTREE_BIT,Skip-worktree bit>> below for more
+ information.
---ignore-skip-worktree-entries::
---no-ignore-skip-worktree-entries::
- Do not remove skip-worktree (AKA "index-only") entries even when
+`--ignore-skip-worktree-entries`::
+`--no-ignore-skip-worktree-entries`::
+ Do not remove "skip-worktree" (AKA "index-only") entries even when
the `--remove` option was specified.
---fsmonitor-valid::
---no-fsmonitor-valid::
+`--fsmonitor-valid`::
+`--no-fsmonitor-valid`::
When one of these flags is specified, the object names recorded
for the paths are not updated. Instead, these options
set and unset the "fsmonitor valid" bit for the paths. See
- section "File System Monitor" below for more information.
+ section <<FILE_SYSTEM_MONITOR,File System Monitor>> below
+ for more information.
--g::
---again::
- Runs 'git update-index' itself on the paths whose index
+`-g`::
+`--again`::
+ Runs `git update-index` itself on the paths whose index
entries are different from those of the `HEAD` commit.
---unresolve::
+`--unresolve`::
Restores the 'unmerged' or 'needs updating' state of a
file during a merge if it was cleared by accident.
---info-only::
+`--info-only`::
Do not create objects in the object database for all
- <file> arguments that follow this flag; just insert
+ _<file>_ arguments that follow this flag; just insert
their object IDs into the index.
---force-remove::
+`--force-remove`::
Remove the file from the index even when the working directory
- still has such a file. (Implies --remove.)
+ still has such a file. (Implies `--remove`.)
---replace::
+`--replace`::
By default, when a file `path` exists in the index,
- 'git update-index' refuses an attempt to add `path/file`.
+ `git update-index` refuses an attempt to add `path/file`.
Similarly if a file `path/file` exists, a file `path`
- cannot be added. With --replace flag, existing entries
+ cannot be added. With `--replace` flag, existing entries
that conflict with the entry being added are
automatically removed with warning messages.
---stdin::
+`--stdin`::
Instead of taking a list of paths from the command line,
read a list of paths from the standard input. Paths are
separated by LF (i.e. one path per line) by default.
---verbose::
+`--verbose`::
Report what is being added and removed from the index.
---index-version <n>::
+`--index-version <n>`::
Write the resulting index out in the named on-disk format version.
Supported versions are 2, 3, and 4. The current default version is 2
or 3, depending on whether extra features are used, such as
@@ -177,19 +179,19 @@ and support for it was added to libgit2 in 2016 and to JGit in 2020.
Older versions of this manual page called it "relatively young", but
it should be considered mature technology these days.
---show-index-version::
+`--show-index-version`::
Report the index format version used by the on-disk index file.
See `--index-version` above.
--z::
+`-z`::
Only meaningful with `--stdin` or `--index-info`; paths are
separated with NUL character instead of LF.
---split-index::
---no-split-index::
+`--split-index`::
+`--no-split-index`::
Enable or disable split index mode. If split-index mode is
already enabled and `--split-index` is given again, all
- changes in $GIT_DIR/index are pushed back to the shared index
+ changes in `$GIT_DIR/index` are pushed back to the shared index
file.
+
These options take effect whatever the value of the `core.splitIndex`
@@ -198,8 +200,8 @@ emitted when the change goes against the configured value, as the
configured value will take effect next time the index is read and this
will remove the intended effect of the option.
---untracked-cache::
---no-untracked-cache::
+`--untracked-cache`::
+`--no-untracked-cache`::
Enable or disable untracked cache feature. Please use
`--test-untracked-cache` before enabling it.
+
@@ -209,7 +211,7 @@ emitted when the change goes against the configured value, as the
configured value will take effect next time the index is read and this
will remove the intended effect of the option.
---test-untracked-cache::
+`--test-untracked-cache`::
Only perform tests on the working directory to make sure
untracked cache can be used. You have to manually enable
untracked cache using `--untracked-cache` or
@@ -219,14 +221,14 @@ will remove the intended effect of the option.
explains what is not working as needed, otherwise the exit
code is 0 and OK is printed.
---force-untracked-cache::
+`--force-untracked-cache`::
Same as `--untracked-cache`. Provided for backwards
compatibility with older versions of Git where
`--untracked-cache` used to imply `--test-untracked-cache` but
this option would enable the extension unconditionally.
---fsmonitor::
---no-fsmonitor::
+`--fsmonitor`::
+`--no-fsmonitor`::
Enable or disable files system monitor feature. These options
take effect whatever the value of the `core.fsmonitor`
configuration variable (see linkgit:git-config[1]). But a warning
@@ -234,15 +236,15 @@ will remove the intended effect of the option.
the configured value will take effect next time the index is
read and this will remove the intended effect of the option.
-\--::
+`--`::
Do not interpret any more arguments as options.
-<file>::
+`<file>`::
Files to act on.
- Note that files beginning with '.' are discarded. This includes
+ Note that files beginning with `.` are discarded. This includes
`./file` and `dir/./file`. If you don't want this, then use
cleaner names.
- The same applies to directories ending '/' and paths with '//'
+ The same applies to directories ending `/` and paths with `//`
USING --REFRESH
---------------
@@ -252,7 +254,7 @@ up to date for mode/content changes. But what it *does* do is to
can refresh the index for a file that hasn't been changed but where
the stat entry is out of date.
-For example, you'd want to do this after doing a 'git read-tree', to link
+For example, you'd want to do this after doing a `git read-tree`, to link
up the stat index details with the proper files.
USING --CACHEINFO OR --INFO-ONLY
@@ -263,9 +265,9 @@ merging.
To pretend you have a file at path with mode and sha1, say:
-----------------
+----
$ git update-index --add --cacheinfo <mode>,<sha1>,<path>
-----------------
+----
`--info-only` is used to register files without placing them in the object
database. This is useful for status-only repositories.
@@ -291,7 +293,7 @@ This format is to stuff `git ls-tree` output into the index.
. mode SP sha1 SP stage TAB path
+
This format is to put higher order stages into the
-index file and matches 'git ls-files --stage' output.
+index file and matches `git ls-files --stage` output.
. mode SP sha1 TAB path
+
@@ -304,41 +306,42 @@ then feeding necessary input lines in the third format.
For example, starting with this index:
-------------
+----
$ git ls-files -s
100644 8a1218a1024a212bb3db30becd860315f9f3ac52 0 frotz
-------------
+----
you can feed the following input to `--index-info`:
-------------
+----
$ git update-index --index-info
0 0000000000000000000000000000000000000000 frotz
100644 8a1218a1024a212bb3db30becd860315f9f3ac52 1 frotz
100755 8a1218a1024a212bb3db30becd860315f9f3ac52 2 frotz
-------------
+----
The first line of the input feeds 0 as the mode to remove the
path; the SHA-1 does not matter as long as it is well formatted.
Then the second and third line feeds stage 1 and stage 2 entries
for that path. After the above, we would end up with this:
-------------
+----
$ git ls-files -s
100644 8a1218a1024a212bb3db30becd860315f9f3ac52 1 frotz
100755 8a1218a1024a212bb3db30becd860315f9f3ac52 2 frotz
-------------
+----
+[[USING_ASSUME_ANCHANGED_BIT]]
USING ``ASSUME UNCHANGED'' BIT
------------------------------
Many operations in Git depend on your filesystem to have an
-efficient `lstat(2)` implementation, so that `st_mtime`
+efficient `lstat`(2) implementation, so that `st_mtime`
information for working tree files can be cheaply checked to see
if the file contents have changed from the version recorded in
the index file. Unfortunately, some filesystems have
-inefficient `lstat(2)`. If your filesystem is one of them, you
+inefficient `lstat`(2). If your filesystem is one of them, you
can set "assume unchanged" bit to paths you have not changed to
cause Git not to do this check. Note that setting this bit on a
path does not mean Git will check the contents of the file to
@@ -362,22 +365,23 @@ unchanged". Note that "assume unchanged" bit is *not* set if
the index (use `git update-index --really-refresh` if you want
to mark them as "assume unchanged").
-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.
+Sometimes users confuse the "assume unchanged" bit with the
+"skip-worktree" bit. See the final paragraph in the
+<<SKIP_WORKTREE_BIT,Skip-worktree bit>> section below for an
+explanation of the differences.
EXAMPLES
--------
To update and refresh only the files already checked out:
-----------------
+----
$ git checkout-index -n -f -a && git update-index --ignore-missing --refresh
-----------------
+----
On an inefficient filesystem with `core.ignorestat` set::
+
-------------
+----
$ git update-index --really-refresh <1>
$ git update-index --no-assume-unchanged foo.c <2>
$ git diff --name-only <3>
@@ -391,23 +395,24 @@ $ git diff --name-only <7>
$ git update-index --no-assume-unchanged foo.c <8>
$ git diff --name-only <9>
M foo.c
-------------
+----
+
-<1> forces lstat(2) to set "assume unchanged" bits for paths that match index.
+<1> forces `lstat`(2) to set "assume unchanged" bits for paths that match index.
<2> mark the path to be edited.
-<3> this does lstat(2) and finds index matches the path.
-<4> this does lstat(2) and finds index does *not* match the path.
+<3> this does `lstat`(2) and finds index matches the path.
+<4> this does `lstat`(2) and finds index does *not* match the path.
<5> registering the new version to index sets "assume unchanged" bit.
<6> and it is assumed unchanged.
<7> even after you edit it.
<8> you can tell about the change after the fact.
-<9> now it checks with lstat(2) and finds it has been changed.
+<9> now it checks with `lstat`(2) and finds it has been changed.
+[[SKIP_WORKTREE_BIT]]
SKIP-WORKTREE BIT
-----------------
-Skip-worktree bit can be defined in one (long) sentence: Tell git to
+"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.
@@ -416,17 +421,17 @@ Note that not all git commands will pay attention to this bit, and
some only partially support it.
The update-index flags and the read-tree capabilities relating to the
-skip-worktree bit predated the introduction of the
+"skip-worktree" bit predated the introduction of the
linkgit:git-sparse-checkout[1] command, which provides a much easier
-way to configure and handle the skip-worktree bits. If you want to
+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
linkgit:git-sparse-checkout[1] in preference to the low-level
update-index and read-tree primitives.
-The primary purpose of the skip-worktree bit is to enable sparse
+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
+paths present. When the "skip-worktree" bit is set, Git commands (such
as `switch`, `pull`, `merge`) 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
@@ -435,19 +440,19 @@ intentional deletion; for example `git add -u` will not stage a
deletion for these files and `git commit -a` will not make a commit
deleting them either.
-Although this bit looks similar to assume-unchanged bit, its goal is
-different. The assume-unchanged bit is for leaving the file in the
+Although this bit looks similar to "assume unchanged" bit, its goal is
+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'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,
+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. `checkout`, `switch`, `pull`,
etc.), and not have its absence be recorded in commits. Note that in
sparse checkouts (setup by `git sparse-checkout` or by configuring
-core.sparseCheckout to true), if a file is marked as skip-worktree in
+`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.
+"skip-worktree" bit for that file.
SPLIT INDEX
-----------
@@ -455,19 +460,19 @@ SPLIT INDEX
This mode is designed for repositories with very large indexes, and
aims at reducing the time it takes to repeatedly write these indexes.
-In this mode, the index is split into two files, $GIT_DIR/index and
-$GIT_DIR/sharedindex.<SHA-1>. Changes are accumulated in
-$GIT_DIR/index, the split index, while the shared index file contains
+In this mode, the index is split into two files, `$GIT_DIR/index` and
+`$GIT_DIR/sharedindex.<SHA-1>`. Changes are accumulated in
+`$GIT_DIR/index`, the split index, while the shared index file contains
all index entries and stays unchanged.
All changes in the split index are pushed back to the shared index
file when the number of entries in the split index reaches a level
-specified by the splitIndex.maxPercentChange config variable (see
+specified by the `splitIndex.maxPercentChange` config variable (see
linkgit:git-config[1]).
Each time a new shared index file is created, the old shared index
files are deleted if their modification time is older than what is
-specified by the splitIndex.sharedIndexExpire config variable (see
+specified by the `splitIndex.sharedIndexExpire` config variable (see
linkgit:git-config[1]).
To avoid deleting a shared index file that is still used, its
@@ -513,25 +518,26 @@ showing a core.untrackedCache bug" commit to git.git. A workaround for
that is (and this might work for other undiscovered bugs in the
future):
-----------------
+----
$ git -c core.untrackedCache=false status
-----------------
+----
This bug has also been shown to affect non-symlink cases of replacing
a directory with a file when it comes to the internal structures of
the untracked cache, but no case has been reported where this resulted in
-wrong "git status" output.
+wrong `git status` output.
There are also cases where existing indexes written by git versions
before 2.17 will reference directories that don't exist anymore,
potentially causing many "could not open directory" warnings to be
-printed on "git status". These are new warnings for existing issues
+printed on `git status`. These are new warnings for existing issues
that were previously silently discarded.
-As with the bug described above the solution is to one-off do a "git
-status" run with `core.untrackedCache=false` to flush out the leftover
+As with the bug described above the solution is to one-off do a `git
+status` run with `core.untrackedCache=false` to flush out the leftover
bad data.
+[[FILE_SYSTEM_MONITOR]]
FILE SYSTEM MONITOR
-------------------
@@ -543,7 +549,7 @@ linkgit:git-fsmonitor{litdd}daemon[1]
and the
"fsmonitor-watchman" section of linkgit:githooks[5]) that can
inform it as to what files have been modified. This enables git to avoid
-having to lstat() every file to find modified files.
+having to `lstat()` every file to find modified files.
When used in conjunction with the untracked cache, it can further improve
performance by avoiding the cost of scanning the entire working directory
@@ -567,19 +573,19 @@ CONFIGURATION
The command honors `core.filemode` configuration variable. If
your repository is on a filesystem whose executable bits are
-unreliable, this should be set to 'false' (see linkgit:git-config[1]).
+unreliable, this should be set to `false` (see linkgit:git-config[1]).
This causes the command to ignore differences in file modes recorded
in the index and the file mode on the filesystem if they differ only on
executable bit. On such an unfortunate filesystem, you may
-need to use 'git update-index --chmod='.
+need to use `git update-index --chmod=`.
Quite similarly, if `core.symlinks` configuration variable is set
-to 'false' (see linkgit:git-config[1]), symbolic links are checked out
+to `false` (see linkgit:git-config[1]), symbolic links are checked out
as plain files, and this command does not modify a recorded file mode
from symbolic link to regular file.
The command looks at `core.ignorestat` configuration variable. See
-'Using "assume unchanged" bit' section above.
+<<USING_ASSUME_ANCHANGED_BIT,Using "assume unchanged" bit>> section above.
The command also looks at `core.trustctime` configuration variable.
It can be useful when the inode change time is regularly modified by
@@ -593,7 +599,7 @@ linkgit:git-config[1]).
NOTES
-----
-Users often try to use the assume-unchanged and skip-worktree bits
+Users often try to use the "assume unchanged" and "skip-worktree" bits
to tell Git to ignore changes to files that are tracked. This does not
work as expected, since Git may still check working tree files against
the index when performing certain operations. In general, Git does not
Range-diff against v2:
1: 07112e8191 ! 1: 6a0ac397e0 doc: update-index: format options correctly
@@ Metadata
Author: Omri Sarig <omri.sarig13@gmail.com>
## Commit message ##
- doc: update-index: format options correctly
+ doc: update-index: update options and section formatting
- The update-index man page had references to several options, which were
- missing the relevant markers, causing them to be formatted as text
- instead of as references.
+ Replace [verse] with [synopsis] in the SYNOPSIS block.
+
+ Backtick-quote all option terms in the OPTIONS section, and
+ convert single-quoted commands and tools in prose to
+ backtick form.
+
+ Create links to referred sections, and update the document
+ to use the links whenever referring to these sections.
+
+ Use "assume unchanged" and "skip-worktree" consistently
+ across the document, and always quoted.
+
+ Use tabs before option description consistently, never using
+ 8 spaces.
Signed-off-by: Omri Sarig <omri.sarig13@gmail.com>
## Documentation/git-update-index.adoc ##
-@@ Documentation/git-update-index.adoc: OPTIONS
- updates are needed by checking stat() information.
+@@ Documentation/git-update-index.adoc: git-update-index - Register file contents in the working tree to the index
+
+ SYNOPSIS
+ --------
+-[verse]
+-'git update-index'
++[synopsis]
++git update-index
+ [--add] [--remove | --force-remove] [--replace]
+ [--refresh] [-q] [--unmerged] [--ignore-missing]
+ [(--cacheinfo <mode>,<object>,<file>)...]
+@@ Documentation/git-update-index.adoc: any 'unmerged' or 'needs updating' state is cleared.
+ See also linkgit:git-add[1] for a more user-friendly way to do some of
+ the most common operations on the index.
+
+-The way 'git update-index' handles files it is told about can be modified
++The way `git update-index` handles files it is told about can be modified
+ using the various options:
+
+ OPTIONS
+ -------
+---add::
++`--add`::
+ If a specified file isn't in the index already then it's
+ added.
+ Default behaviour is to ignore new files.
+
+---remove::
++`--remove`::
+ If a specified file is in the index but is missing then it's
+ removed.
+ Default behavior is to ignore removed files.
+
+---refresh::
++`--refresh`::
+ Looks at the current index and checks to see if merges or
+- updates are needed by checking stat() information.
++ updates are needed by checking `stat()` information.
- -q::
+--q::
- Quiet. If --refresh finds that the index needs an update, the
-+ Quiet. If `--refresh` finds that the index needs an update, the
- default behavior is to error out. This option makes
- 'git update-index' continue anyway.
+- default behavior is to error out. This option makes
+- 'git update-index' continue anyway.
++`-q`::
++ Quiet. If `--refresh` finds that the index needs an update, the
++ default behavior is to error out. This option makes
++ `git update-index` continue anyway.
- --ignore-submodules::
+---ignore-submodules::
++`--ignore-submodules`::
Do not try to update submodules. This option is only respected
- when passed before --refresh.
+ when passed before `--refresh`.
- --unmerged::
+---unmerged::
- If --refresh finds unmerged changes in the index, the default
-+ If `--refresh` finds unmerged changes in the index, the default
- behavior is to error out. This option makes 'git update-index'
- continue anyway.
+- behavior is to error out. This option makes 'git update-index'
+- continue anyway.
++`--unmerged`::
++ If `--refresh` finds unmerged changes in the index, the default
++ behavior is to error out. This option makes `git update-index`
++ continue anyway.
- --ignore-missing::
+---ignore-missing::
- Ignores missing files during a --refresh
++`--ignore-missing`::
+ Ignores missing files during a `--refresh`
- --cacheinfo <mode>,<object>,<path>::
- --cacheinfo <mode> <object> <path>::
-@@ Documentation/git-update-index.adoc: you will need to handle the situation manually.
+---cacheinfo <mode>,<object>,<path>::
+---cacheinfo <mode> <object> <path>::
++`--cacheinfo <mode>,<object>,<path>`::
++`--cacheinfo <mode> <object> <path>`::
+ Directly insert the specified info into the index. For
+ backward compatibility, you can also give these three
+ arguments as three separate parameters, but new users are
+ encouraged to use a single-parameter form.
+
+---index-info::
+- Read index information from stdin.
++`--index-info`::
++ Read index information from stdin.
+
+---chmod=(+|-)x::
+- Set the execute permissions on the updated files.
++`--chmod=(+|-)x`::
++ Set the execute permissions on the updated files.
+
+---assume-unchanged::
+---no-assume-unchanged::
++`--assume-unchanged`::
++`--no-assume-unchanged`::
+ When this flag is specified, the object names recorded
+ for the paths are not updated. Instead, this option
+ sets/unsets the "assume unchanged" bit for the
+@@ Documentation/git-update-index.adoc: OPTIONS
+ the index. If you want to change the working tree file,
+ you need to unset the bit to tell Git. This is
+ sometimes helpful when working with a big project on a
+- filesystem that has a very slow lstat(2) system call
++ filesystem that has a very slow `lstat`(2) system call
+ (e.g. cifs).
+ +
+ Git will fail (gracefully) in case it needs to modify this file
+@@ Documentation/git-update-index.adoc: in the index e.g. when merging in a commit;
+ thus, in case the assumed-untracked file is changed upstream,
+ you will need to handle the situation manually.
+
+---really-refresh::
++`--really-refresh`::
+ Like `--refresh`, but checks stat information unconditionally,
+ without regard to the "assume unchanged" setting.
+
+---skip-worktree::
+---no-skip-worktree::
++`--skip-worktree`::
++`--no-skip-worktree`::
+ When one of these flags is specified, the object names recorded
+ for the paths are not updated. Instead, these options
+ set and unset the "skip-worktree" bit for the paths. See
+- section "Skip-worktree bit" below for more information.
++ section <<SKIP_WORKTREE_BIT,Skip-worktree bit>> below for more
++ information.
+
+
+---ignore-skip-worktree-entries::
+---no-ignore-skip-worktree-entries::
+- Do not remove skip-worktree (AKA "index-only") entries even when
++`--ignore-skip-worktree-entries`::
++`--no-ignore-skip-worktree-entries`::
++ Do not remove "skip-worktree" (AKA "index-only") entries even when
+ the `--remove` option was specified.
+
+---fsmonitor-valid::
+---no-fsmonitor-valid::
++`--fsmonitor-valid`::
++`--no-fsmonitor-valid`::
+ When one of these flags is specified, the object names recorded
+ for the paths are not updated. Instead, these options
+ set and unset the "fsmonitor valid" bit for the paths. See
+- section "File System Monitor" below for more information.
++ section <<FILE_SYSTEM_MONITOR,File System Monitor>> below
++ for more information.
+
+--g::
+---again::
+- Runs 'git update-index' itself on the paths whose index
++`-g`::
++`--again`::
++ Runs `git update-index` itself on the paths whose index
+ entries are different from those of the `HEAD` commit.
- --force-remove::
+---unresolve::
++`--unresolve`::
+ Restores the 'unmerged' or 'needs updating' state of a
+ file during a merge if it was cleared by accident.
+
+---info-only::
++`--info-only`::
+ Do not create objects in the object database for all
+- <file> arguments that follow this flag; just insert
++ _<file>_ arguments that follow this flag; just insert
+ their object IDs into the index.
+
+---force-remove::
++`--force-remove`::
Remove the file from the index even when the working directory
- still has such a file. (Implies --remove.)
+ still has such a file. (Implies `--remove`.)
- --replace::
+---replace::
++`--replace`::
By default, when a file `path` exists in the index,
+- 'git update-index' refuses an attempt to add `path/file`.
++ `git update-index` refuses an attempt to add `path/file`.
+ Similarly if a file `path/file` exists, a file `path`
+- cannot be added. With --replace flag, existing entries
++ cannot be added. With `--replace` flag, existing entries
+ that conflict with the entry being added are
+ automatically removed with warning messages.
+
+---stdin::
++`--stdin`::
+ Instead of taking a list of paths from the command line,
+ read a list of paths from the standard input. Paths are
+ separated by LF (i.e. one path per line) by default.
+
+---verbose::
++`--verbose`::
+ Report what is being added and removed from the index.
+
+---index-version <n>::
++`--index-version <n>`::
+ Write the resulting index out in the named on-disk format version.
+ Supported versions are 2, 3, and 4. The current default version is 2
+ or 3, depending on whether extra features are used, such as
+@@ Documentation/git-update-index.adoc: and support for it was added to libgit2 in 2016 and to JGit in 2020.
+ Older versions of this manual page called it "relatively young", but
+ it should be considered mature technology these days.
+
+---show-index-version::
++`--show-index-version`::
+ Report the index format version used by the on-disk index file.
+ See `--index-version` above.
+
+--z::
++`-z`::
+ Only meaningful with `--stdin` or `--index-info`; paths are
+ separated with NUL character instead of LF.
+
+---split-index::
+---no-split-index::
++`--split-index`::
++`--no-split-index`::
+ Enable or disable split index mode. If split-index mode is
+ already enabled and `--split-index` is given again, all
+- changes in $GIT_DIR/index are pushed back to the shared index
++ changes in `$GIT_DIR/index` are pushed back to the shared index
+ file.
+ +
+ These options take effect whatever the value of the `core.splitIndex`
+@@ Documentation/git-update-index.adoc: emitted when the change goes against the configured value, as the
+ configured value will take effect next time the index is read and this
+ will remove the intended effect of the option.
+
+---untracked-cache::
+---no-untracked-cache::
++`--untracked-cache`::
++`--no-untracked-cache`::
+ Enable or disable untracked cache feature. Please use
+ `--test-untracked-cache` before enabling it.
+ +
+@@ Documentation/git-update-index.adoc: emitted when the change goes against the configured value, as the
+ configured value will take effect next time the index is read and this
+ will remove the intended effect of the option.
+
+---test-untracked-cache::
++`--test-untracked-cache`::
+ Only perform tests on the working directory to make sure
+ untracked cache can be used. You have to manually enable
+ untracked cache using `--untracked-cache` or
+@@ Documentation/git-update-index.adoc: will remove the intended effect of the option.
+ explains what is not working as needed, otherwise the exit
+ code is 0 and OK is printed.
+
+---force-untracked-cache::
++`--force-untracked-cache`::
+ Same as `--untracked-cache`. Provided for backwards
+ compatibility with older versions of Git where
+ `--untracked-cache` used to imply `--test-untracked-cache` but
+ this option would enable the extension unconditionally.
+
+---fsmonitor::
+---no-fsmonitor::
++`--fsmonitor`::
++`--no-fsmonitor`::
+ Enable or disable files system monitor feature. These options
+ take effect whatever the value of the `core.fsmonitor`
+ configuration variable (see linkgit:git-config[1]). But a warning
+@@ Documentation/git-update-index.adoc: will remove the intended effect of the option.
+ the configured value will take effect next time the index is
+ read and this will remove the intended effect of the option.
+
+-\--::
++`--`::
+ Do not interpret any more arguments as options.
+
+-<file>::
++`<file>`::
+ Files to act on.
+- Note that files beginning with '.' are discarded. This includes
++ Note that files beginning with `.` are discarded. This includes
+ `./file` and `dir/./file`. If you don't want this, then use
+ cleaner names.
+- The same applies to directories ending '/' and paths with '//'
++ The same applies to directories ending `/` and paths with `//`
+
+ USING --REFRESH
+ ---------------
+@@ Documentation/git-update-index.adoc: up to date for mode/content changes. But what it *does* do is to
+ can refresh the index for a file that hasn't been changed but where
+ the stat entry is out of date.
+
+-For example, you'd want to do this after doing a 'git read-tree', to link
++For example, you'd want to do this after doing a `git read-tree`, to link
+ up the stat index details with the proper files.
+
+ USING --CACHEINFO OR --INFO-ONLY
+@@ Documentation/git-update-index.adoc: merging.
+
+ To pretend you have a file at path with mode and sha1, say:
+
+-----------------
++----
+ $ git update-index --add --cacheinfo <mode>,<sha1>,<path>
+-----------------
++----
+
+ `--info-only` is used to register files without placing them in the object
+ database. This is useful for status-only repositories.
+@@ Documentation/git-update-index.adoc: This format is to stuff `git ls-tree` output into the index.
+ . mode SP sha1 SP stage TAB path
+ +
+ This format is to put higher order stages into the
+-index file and matches 'git ls-files --stage' output.
++index file and matches `git ls-files --stage` output.
+
+ . mode SP sha1 TAB path
+ +
+@@ Documentation/git-update-index.adoc: then feeding necessary input lines in the third format.
+
+ For example, starting with this index:
+
+-------------
++----
+ $ git ls-files -s
+ 100644 8a1218a1024a212bb3db30becd860315f9f3ac52 0 frotz
+-------------
++----
+
+ you can feed the following input to `--index-info`:
+
+-------------
++----
+ $ git update-index --index-info
+ 0 0000000000000000000000000000000000000000 frotz
+ 100644 8a1218a1024a212bb3db30becd860315f9f3ac52 1 frotz
+ 100755 8a1218a1024a212bb3db30becd860315f9f3ac52 2 frotz
+-------------
++----
+
+ The first line of the input feeds 0 as the mode to remove the
+ path; the SHA-1 does not matter as long as it is well formatted.
+ Then the second and third line feeds stage 1 and stage 2 entries
+ for that path. After the above, we would end up with this:
+
+-------------
++----
+ $ git ls-files -s
+ 100644 8a1218a1024a212bb3db30becd860315f9f3ac52 1 frotz
+ 100755 8a1218a1024a212bb3db30becd860315f9f3ac52 2 frotz
+-------------
++----
+
+
++[[USING_ASSUME_ANCHANGED_BIT]]
+ USING ``ASSUME UNCHANGED'' BIT
+ ------------------------------
+
+ Many operations in Git depend on your filesystem to have an
+-efficient `lstat(2)` implementation, so that `st_mtime`
++efficient `lstat`(2) implementation, so that `st_mtime`
+ information for working tree files can be cheaply checked to see
+ if the file contents have changed from the version recorded in
+ the index file. Unfortunately, some filesystems have
+-inefficient `lstat(2)`. If your filesystem is one of them, you
++inefficient `lstat`(2). If your filesystem is one of them, you
+ can set "assume unchanged" bit to paths you have not changed to
+ cause Git not to do this check. Note that setting this bit on a
+ path does not mean Git will check the contents of the file to
+@@ Documentation/git-update-index.adoc: unchanged". Note that "assume unchanged" bit is *not* set if
+ the index (use `git update-index --really-refresh` if you want
+ to mark them as "assume unchanged").
+
+-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.
++Sometimes users confuse the "assume unchanged" bit with the
++"skip-worktree" bit. See the final paragraph in the
++<<SKIP_WORKTREE_BIT,Skip-worktree bit>> section below for an
++explanation of the differences.
+
+
+ EXAMPLES
+ --------
+ To update and refresh only the files already checked out:
+
+-----------------
++----
+ $ git checkout-index -n -f -a && git update-index --ignore-missing --refresh
+-----------------
++----
+
+ On an inefficient filesystem with `core.ignorestat` set::
+ +
+-------------
++----
+ $ git update-index --really-refresh <1>
+ $ git update-index --no-assume-unchanged foo.c <2>
+ $ git diff --name-only <3>
+@@ Documentation/git-update-index.adoc: $ git diff --name-only <7>
+ $ git update-index --no-assume-unchanged foo.c <8>
+ $ git diff --name-only <9>
+ M foo.c
+-------------
++----
+ +
+-<1> forces lstat(2) to set "assume unchanged" bits for paths that match index.
++<1> forces `lstat`(2) to set "assume unchanged" bits for paths that match index.
+ <2> mark the path to be edited.
+-<3> this does lstat(2) and finds index matches the path.
+-<4> this does lstat(2) and finds index does *not* match the path.
++<3> this does `lstat`(2) and finds index matches the path.
++<4> this does `lstat`(2) and finds index does *not* match the path.
+ <5> registering the new version to index sets "assume unchanged" bit.
+ <6> and it is assumed unchanged.
+ <7> even after you edit it.
+ <8> you can tell about the change after the fact.
+-<9> now it checks with lstat(2) and finds it has been changed.
++<9> now it checks with `lstat`(2) and finds it has been changed.
+
+
++[[SKIP_WORKTREE_BIT]]
+ SKIP-WORKTREE BIT
+ -----------------
+
+-Skip-worktree bit can be defined in one (long) sentence: Tell git to
++"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.
+@@ Documentation/git-update-index.adoc: Note that not all git commands will pay attention to this bit, and
+ some only partially support it.
+
+ The update-index flags and the read-tree capabilities relating to the
+-skip-worktree bit predated the introduction of the
++"skip-worktree" bit predated the introduction of the
+ linkgit:git-sparse-checkout[1] command, which provides a much easier
+-way to configure and handle the skip-worktree bits. If you want to
++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
+ linkgit:git-sparse-checkout[1] in preference to the low-level
+ update-index and read-tree primitives.
+
+-The primary purpose of the skip-worktree bit is to enable sparse
++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
++paths present. When the "skip-worktree" bit is set, Git commands (such
+ as `switch`, `pull`, `merge`) 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
+@@ Documentation/git-update-index.adoc: intentional deletion; for example `git add -u` will not stage a
+ deletion for these files and `git commit -a` will not make a commit
+ deleting them either.
+
+-Although this bit looks similar to assume-unchanged bit, its goal is
+-different. The assume-unchanged bit is for leaving the file in the
++Although this bit looks similar to "assume unchanged" bit, its goal is
++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'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,
++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. `checkout`, `switch`, `pull`,
+ etc.), and not have its absence be recorded in commits. Note that in
+ sparse checkouts (setup by `git sparse-checkout` or by configuring
+-core.sparseCheckout to true), if a file is marked as skip-worktree in
++`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.
++"skip-worktree" bit for that file.
+
+ SPLIT INDEX
+ -----------
+@@ Documentation/git-update-index.adoc: SPLIT INDEX
+ This mode is designed for repositories with very large indexes, and
+ aims at reducing the time it takes to repeatedly write these indexes.
+
+-In this mode, the index is split into two files, $GIT_DIR/index and
+-$GIT_DIR/sharedindex.<SHA-1>. Changes are accumulated in
+-$GIT_DIR/index, the split index, while the shared index file contains
++In this mode, the index is split into two files, `$GIT_DIR/index` and
++`$GIT_DIR/sharedindex.<SHA-1>`. Changes are accumulated in
++`$GIT_DIR/index`, the split index, while the shared index file contains
+ all index entries and stays unchanged.
+
+ All changes in the split index are pushed back to the shared index
+ file when the number of entries in the split index reaches a level
+-specified by the splitIndex.maxPercentChange config variable (see
++specified by the `splitIndex.maxPercentChange` config variable (see
+ linkgit:git-config[1]).
+
+ Each time a new shared index file is created, the old shared index
+ files are deleted if their modification time is older than what is
+-specified by the splitIndex.sharedIndexExpire config variable (see
++specified by the `splitIndex.sharedIndexExpire` config variable (see
+ linkgit:git-config[1]).
+
+ To avoid deleting a shared index file that is still used, its
+@@ Documentation/git-update-index.adoc: showing a core.untrackedCache bug" commit to git.git. A workaround for
+ that is (and this might work for other undiscovered bugs in the
+ future):
+
+-----------------
++----
+ $ git -c core.untrackedCache=false status
+-----------------
++----
+
+ This bug has also been shown to affect non-symlink cases of replacing
+ a directory with a file when it comes to the internal structures of
+ the untracked cache, but no case has been reported where this resulted in
+-wrong "git status" output.
++wrong `git status` output.
+
+ There are also cases where existing indexes written by git versions
+ before 2.17 will reference directories that don't exist anymore,
+ potentially causing many "could not open directory" warnings to be
+-printed on "git status". These are new warnings for existing issues
++printed on `git status`. These are new warnings for existing issues
+ that were previously silently discarded.
+
+-As with the bug described above the solution is to one-off do a "git
+-status" run with `core.untrackedCache=false` to flush out the leftover
++As with the bug described above the solution is to one-off do a `git
++status` run with `core.untrackedCache=false` to flush out the leftover
+ bad data.
+
++[[FILE_SYSTEM_MONITOR]]
+ FILE SYSTEM MONITOR
+ -------------------
+
+@@ Documentation/git-update-index.adoc: linkgit:git-fsmonitor{litdd}daemon[1]
+ and the
+ "fsmonitor-watchman" section of linkgit:githooks[5]) that can
+ inform it as to what files have been modified. This enables git to avoid
+-having to lstat() every file to find modified files.
++having to `lstat()` every file to find modified files.
+
+ When used in conjunction with the untracked cache, it can further improve
+ performance by avoiding the cost of scanning the entire working directory
+@@ Documentation/git-update-index.adoc: CONFIGURATION
+
+ The command honors `core.filemode` configuration variable. If
+ your repository is on a filesystem whose executable bits are
+-unreliable, this should be set to 'false' (see linkgit:git-config[1]).
++unreliable, this should be set to `false` (see linkgit:git-config[1]).
+ This causes the command to ignore differences in file modes recorded
+ in the index and the file mode on the filesystem if they differ only on
+ executable bit. On such an unfortunate filesystem, you may
+-need to use 'git update-index --chmod='.
++need to use `git update-index --chmod=`.
+
+ Quite similarly, if `core.symlinks` configuration variable is set
+-to 'false' (see linkgit:git-config[1]), symbolic links are checked out
++to `false` (see linkgit:git-config[1]), symbolic links are checked out
+ as plain files, and this command does not modify a recorded file mode
+ from symbolic link to regular file.
+
+ The command looks at `core.ignorestat` configuration variable. See
+-'Using "assume unchanged" bit' section above.
++<<USING_ASSUME_ANCHANGED_BIT,Using "assume unchanged" bit>> section above.
+
+ The command also looks at `core.trustctime` configuration variable.
+ It can be useful when the inode change time is regularly modified by
+@@ Documentation/git-update-index.adoc: linkgit:git-config[1]).
+ NOTES
+ -----
+
+-Users often try to use the assume-unchanged and skip-worktree bits
++Users often try to use the "assume unchanged" and "skip-worktree" bits
+ to tell Git to ignore changes to files that are tracked. This does not
+ work as expected, since Git may still check working tree files against
+ the index when performing certain operations. In general, Git does not
base-commit: 03b41523c576f26ad34085378717a0c1b287470f
^ permalink raw reply related [flat|nested] 9+ messages in thread