Home Explore Blog CI



git

8th chunk of `Documentation/git-update-index.adoc`
702ee9100ba47e8a7387457de1cf3e646b18eeb5ebf2cc730000000100000f90
 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.

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
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
bad data.

FILE SYSTEM MONITOR
-------------------

This feature is intended to speed up git operations for repos that have
large working directories.

It enables git to work together with a file system monitor (see
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.

When used in conjunction with the untracked cache, it can further improve
performance by avoiding the cost of scanning the entire working directory
looking for new files.

If you want to enable (or disable) this feature, it is easier to use
the `core.fsmonitor` configuration variable (see
linkgit:git-config[1]) than using the `--fsmonitor` option to `git
update-index` in each repository, especially if you want to do so
across all repositories you use, because you can set the configuration
variable in your `$HOME/.gitconfig` just once and have it affect all
repositories you touch.

When the `core.fsmonitor` configuration variable is changed, the
file system monitor is added to or removed from the index the next time
a command reads the index. When `--[no-]fsmonitor` are used, the file
system monitor is immediately added to or removed from the index.

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]).
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='.

Quite similarly, if `core.symlinks` configuration variable is set
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.

The command also looks at `core.trustctime` configuration variable.
It can be useful when the inode change time is regularly modified by
something outside Git (file system crawlers and backup systems use
ctime for marking files processed) (see linkgit:git-config[1]).

The untracked cache extension can be enabled by the
`core.untrackedCache` configuration variable (see
linkgit:git-config[1]).

NOTES
-----

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
provide a way to ignore changes to tracked files, so alternate solutions
are recommended.

For example, if the file you want to change is some sort of config file,
the repository can include a sample config file that can then be copied
into the ignored name and modified.  The repository can even include a
script to treat the sample file as a template, modifying and copying it
automatically.

SEE ALSO
--------
linkgit:git-config[1],
linkgit:git-add[1],
linkgit:git-ls-files[1]

GIT
---
Part of the linkgit:git[1] suite

Title: Git Configuration and Performance Optimization
Summary
This section discusses Git features and configurations that improve performance, including the file system monitor, untracked cache, and various configuration variables, as well as notes on using Git effectively, such as ignoring changes to tracked files and using sample config files.