Home Explore Blog CI



git

1st chunk of `Documentation/git-read-tree.adoc`
16f3fede0f6c4f81865282af6dd206fe5da779d09f6fb2410000000100000fa6
git-read-tree(1)
================

NAME
----
git-read-tree - Reads tree information into the index


SYNOPSIS
--------
[verse]
'git read-tree' [(-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>)
		[-u | -i]] [--index-output=<file>] [--no-sparse-checkout]
		(--empty | <tree-ish1> [<tree-ish2> [<tree-ish3>]])


DESCRIPTION
-----------
Reads the tree information given by <tree-ish> into the index,
but does not actually *update* any of the files it "caches". (see:
linkgit:git-checkout-index[1])

Optionally, it can merge a tree into the index, perform a
fast-forward (i.e. 2-way) merge, or a 3-way merge, with the `-m`
flag.  When used with `-m`, the `-u` flag causes it to also update
the files in the work tree with the result of the merge.

Only trivial merges are done by 'git read-tree' itself.  Only conflicting paths
will be in an unmerged state when 'git read-tree' returns.

OPTIONS
-------
-m::
	Perform a merge, not just a read.  The command will
	refuse to run if your index file has unmerged entries,
	indicating that you have not finished a previous merge you
	started.

--reset::
	Same as -m, except that unmerged entries are discarded instead
	of failing.  When used with `-u`, updates leading to loss of
	working tree changes or untracked files or directories will not
	abort the operation.

-u::
	After a successful merge, update the files in the work
	tree with the result of the merge.

-i::
	Usually a merge requires the index file as well as the
	files in the working tree to be up to date with the
	current head commit, in order not to lose local
	changes.  This flag disables the check with the working
	tree and is meant to be used when creating a merge of
	trees that are not directly related to the current
	working tree status into a temporary index file.

-n::
--dry-run::
	Check if the command would error out, without updating the index
	or the files in the working tree for real.

-v::
	Show the progress of checking files out.

--trivial::
	Restrict three-way merge by 'git read-tree' to happen
	only if there is no file-level merging required, instead
	of resolving merge for trivial cases and leaving
	conflicting files unresolved in the index.

--aggressive::
	Usually a three-way merge by 'git read-tree' resolves
	the merge for really trivial cases and leaves other
	cases unresolved in the index, so that porcelains can
	implement different merge policies.  This flag makes the
	command resolve a few more cases internally:
+
* when one side removes a path and the other side leaves the path
  unmodified.  The resolution is to remove that path.
* when both sides remove a path.  The resolution is to remove that path.
* when both sides add a path identically.  The resolution
  is to add that path.

--prefix=<prefix>::
	Keep the current index contents, and read the contents
	of the named tree-ish under the directory at `<prefix>`.
	The command will refuse to overwrite entries that already
	existed in the original index file.

--index-output=<file>::
	Instead of writing the results out to `$GIT_INDEX_FILE`,
	write the resulting index in the named file.  While the
	command is operating, the original index file is locked
	with the same mechanism as usual.  The file must allow
	to be rename(2)ed into from a temporary file that is
	created next to the usual index file; typically this
	means it needs to be on the same filesystem as the index
	file itself, and you need write permission to the
	directories the index file and index output file are
	located in.

--[no-]recurse-submodules::
	Using --recurse-submodules will update the content of all active
	submodules according to the commit recorded in the superproject by
	calling read-tree recursively, also setting the submodules' HEAD to be
	detached at that commit.

--no-sparse-checkout::
	Disable sparse checkout support even if `core.sparseCheckout`
	is true.

--empty::
	Instead of reading tree object(s) into the index, just empty
	it.

-q::
--quiet::
	Quiet, suppress feedback messages.

Title: Git Read Tree Command
Summary
The git read-tree command reads tree information into the index, allowing for merges, updates, and other operations on the Git repository, with various options to control its behavior and output, including merging, fast-forwarding, and resolving conflicts, and can also update the work tree with the result of the merge, making it a powerful tool for managing Git repositories and resolving complex merge scenarios.