Home Explore Blog CI



git

1st chunk of `Documentation/git-update-index.adoc`
f70e14716fb1b61e97b0356aeb642acc007196c2e03ab57c0000000100000fa3
git-update-index(1)
===================

NAME
----
git-update-index - Register file contents in the working tree to the index


SYNOPSIS
--------
[verse]
'git update-index'
	     [--add] [--remove | --force-remove] [--replace]
	     [--refresh] [-q] [--unmerged] [--ignore-missing]
	     [(--cacheinfo <mode>,<object>,<file>)...]
	     [--chmod=(+|-)x]
	     [--[no-]assume-unchanged]
	     [--[no-]skip-worktree]
	     [--[no-]ignore-skip-worktree-entries]
	     [--[no-]fsmonitor-valid]
	     [--ignore-submodules]
	     [--[no-]split-index]
	     [--[no-|test-|force-]untracked-cache]
	     [--[no-]fsmonitor]
	     [--really-refresh] [--unresolve] [--again | -g]
	     [--info-only] [--index-info]
	     [-z] [--stdin] [--index-version <n>]
	     [--show-index-version]
	     [--verbose]
	     [--] [<file>...]

DESCRIPTION
-----------
Modifies the index. Each file mentioned is updated into the index and
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
using the various options:

OPTIONS
-------
--add::
	If a specified file isn't in the index already then it's
	added.
	Default behaviour is to ignore new files.

--remove::
	If a specified file is in the index but is missing then it's
	removed.
	Default behavior is to ignore removed files.

--refresh::
	Looks at the current index and checks to see if merges or
	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.

--ignore-submodules::
	Do not try to update submodules.  This option is only respected
	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.

--ignore-missing::
	Ignores missing files during a --refresh

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

--chmod=(+|-)x::
        Set the execute permissions on the updated files.

--[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
	paths.  When the "assume unchanged" bit is on, the user
	promises not to change the file and allows Git to assume
	that the working tree file matches what is recorded in
	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
	(e.g. cifs).
+
Git will fail (gracefully) in case it needs to modify this file
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::
	Like `--refresh`, but checks stat information unconditionally,
	without regard to the "assume unchanged" setting.

--[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.


--[no-]ignore-skip-worktree-entries::
	Do not remove skip-worktree (AKA "index-only") entries even when
	the `--remove` option was specified.

--[no-]fsmonitor-valid::
	When one of these flags is specified, the object names recorded
	for the paths are not updated. Instead, these

Title: Git Update Index Command
Summary
The git-update-index command is used to register file contents in the working tree to the index, allowing for various operations such as adding, removing, and refreshing files, as well as modifying the index's behavior using various options.