LinuxCommandLibrary

git-mktree

Create tree object from ls-tree format

TLDR

Create tree from ls-tree output

$ git ls-tree HEAD | git mktree
copy
Create tree from file
$ git mktree < [tree-listing.txt]
copy
Allow missing objects
$ git mktree --missing
copy

SYNOPSIS

git mktree [options]

DESCRIPTION

git mktree creates a tree object from ls-tree formatted input. It reads file modes, object types, hashes, and names from stdin, creating a new tree object containing those entries. The command is the inverse of `git ls-tree`.
This plumbing tool enables programmatic tree creation and manipulation in scripts. Input must be properly formatted with each line specifying mode, type, hash, and filename.

PARAMETERS

--missing

Allow missing objects.
-z
NUL-terminated input.
--batch
Process multiple trees.
--help
Display help information.

CAVEATS

Plumbing command. Input must be properly formatted. Objects must exist unless --missing.

HISTORY

git mktree is a core Git plumbing command for tree object creation, enabling programmatic manipulation of git's tree structure.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community