{
    "content": [
        {
            "type": "text",
            "text": "# git-mktree (man)\n\n## NAME\n\ngit-mktree - Build a tree-object from ls-tree formatted text\n\n## SYNOPSIS\n\ngit mktree [-z] [--missing] [--batch]\n\n## DESCRIPTION\n\nReads standard input in non-recursive ls-tree output format, and creates a tree object. The\norder of the tree entries is normalized by mktree so pre-sorting the input is not required.\nThe object name of the tree object built is written to the standard output.\n\n## TLDR\n\n> Build a tree object using `ls-tree` formatted text.\n\n- Build a tree object and verify that each tree entry's hash identifies an existing object:\n  `git mktree`\n- Allow missing objects:\n  `git mktree --missing`\n- Read the NUL ([z]ero character) terminated output of the tree object (`git ls-tree -z`):\n  `git mktree -z`\n- Allow the creation of multiple tree objects:\n  `git mktree --batch`\n- Sort and build a tree from `stdin` (non-recursive `git ls-tree` output format is required):\n  `git < {{path/to/tree.txt}} mktree`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **OPTIONS** (3 subsections)\n- **GIT**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "git-mktree",
        "section": "",
        "mode": "man",
        "summary": "git-mktree - Build a tree-object from ls-tree formatted text",
        "synopsis": "git mktree [-z] [--missing] [--batch]",
        "tldr_summary": "Build a tree object using `ls-tree` formatted text.",
        "tldr_examples": [
            {
                "description": "Build a tree object and verify that each tree entry's hash identifies an existing object",
                "command": "git mktree"
            },
            {
                "description": "Allow missing objects",
                "command": "git mktree --missing"
            },
            {
                "description": "Read the NUL ([z]ero character) terminated output of the tree object (`git ls-tree -z`)",
                "command": "git mktree -z"
            },
            {
                "description": "Allow the creation of multiple tree objects",
                "command": "git mktree --batch"
            },
            {
                "description": "Sort and build a tree from `stdin` (non-recursive `git ls-tree` output format is required)",
                "command": "git < {{path/to/tree.txt}} mktree"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "-z",
                "long": null,
                "arg": null,
                "description": "Read the NUL-terminated ls-tree -z output instead."
            },
            {
                "flag": "",
                "long": "--missing",
                "arg": null,
                "description": "Allow missing objects. The default behaviour (without this option) is to verify that each tree entry’s sha1 identifies an existing object. This option has no effect on the treatment of gitlink entries (aka \"submodules\") which are always allowed to be missing."
            },
            {
                "flag": "",
                "long": "--batch",
                "arg": null,
                "description": "Allow building of more than one tree object before exiting. Each tree is separated by as single blank line. The final new-line is optional. Note - if the -z option is used, lines are terminated with NUL."
            }
        ],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-z",
                        "lines": 2,
                        "flag": "-z"
                    },
                    {
                        "name": "--missing",
                        "lines": 4,
                        "long": "--missing"
                    },
                    {
                        "name": "--batch",
                        "lines": 4,
                        "long": "--batch"
                    }
                ]
            },
            {
                "name": "GIT",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "git-mktree - Build a tree-object from ls-tree formatted text\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "git mktree [-z] [--missing] [--batch]\n\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "Reads standard input in non-recursive ls-tree output format, and creates a tree object. The\norder of the tree entries is normalized by mktree so pre-sorting the input is not required.\nThe object name of the tree object built is written to the standard output.\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "-z",
                        "content": "Read the NUL-terminated ls-tree -z output instead.\n",
                        "flag": "-z"
                    },
                    {
                        "name": "--missing",
                        "content": "Allow missing objects. The default behaviour (without this option) is to verify that each\ntree entry’s sha1 identifies an existing object. This option has no effect on the\ntreatment of gitlink entries (aka \"submodules\") which are always allowed to be missing.\n",
                        "long": "--missing"
                    },
                    {
                        "name": "--batch",
                        "content": "Allow building of more than one tree object before exiting. Each tree is separated by as\nsingle blank line. The final new-line is optional. Note - if the -z option is used, lines\nare terminated with NUL.\n",
                        "long": "--batch"
                    }
                ]
            },
            "GIT": {
                "content": "Part of the git(1) suite\n\n\n\nGit 2.34.1                                   02/26/2026                                GIT-MKTREE(1)",
                "subsections": []
            }
        }
    }
}