{
    "content": [
        {
            "type": "text",
            "text": "# GIT-COMMIT-TREE (man)\n\n## NAME\n\ngit-commit-tree - Create a new commit object\n\n## SYNOPSIS\n\ngit commit-tree <tree> [(-p <parent>)...]\ngit commit-tree [(-p <parent>)...] [-S[<keyid>]] [(-m <message>)...]\n[(-F <file>)...] <tree>\n\n## DESCRIPTION\n\nThis is usually not what an end user wants to run directly. See git-commit(1) instead.\n\n## TLDR\n\n> Low level utility to create commit objects.\n\n- Create a commit object with the specified message:\n  `git commit-tree {{tree}} -m \"{{message}}\"`\n- Create a commit object reading the message from a file (use `-` for `stdin`):\n  `git commit-tree {{tree}} -F {{path/to/file}}`\n- Create a GPG-signed commit object:\n  `git commit-tree {{tree}} -m \"{{message}}\" {{-S|--gpg-sign}}`\n- Create a commit object with the specified parent commit object:\n  `git commit-tree {{tree}} -m \"{{message}}\" -p {{parent_commit_sha}}`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **OPTIONS** (3 subsections)\n- **COMMIT INFORMATION**\n- **DATE FORMATS**\n- **DISCUSSION**\n- **FILES**\n- **SEE ALSO**\n- **GIT**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "GIT-COMMIT-TREE",
        "section": "",
        "mode": "man",
        "summary": "git-commit-tree - Create a new commit object",
        "synopsis": "git commit-tree <tree> [(-p <parent>)...]\ngit commit-tree [(-p <parent>)...] [-S[<keyid>]] [(-m <message>)...]\n[(-F <file>)...] <tree>",
        "tldr_summary": "Low level utility to create commit objects.",
        "tldr_examples": [
            {
                "description": "Create a commit object with the specified message",
                "command": "git commit-tree {{tree}} -m \"{{message}}\""
            },
            {
                "description": "Create a commit object reading the message from a file (use `-` for `stdin`)",
                "command": "git commit-tree {{tree}} -F {{path/to/file}}"
            },
            {
                "description": "Create a GPG-signed commit object",
                "command": "git commit-tree {{tree}} -m \"{{message}}\" {{-S|--gpg-sign}}"
            },
            {
                "description": "Create a commit object with the specified parent commit object",
                "command": "git commit-tree {{tree}} -m \"{{message}}\" -p {{parent_commit_sha}}"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "-p",
                "long": null,
                "arg": "<parent>",
                "description": "Each -p indicates the id of a parent commit object."
            },
            {
                "flag": "-m",
                "long": null,
                "arg": "<message>",
                "description": "A paragraph in the commit log message. This can be given more than once and each <message> becomes its own paragraph."
            },
            {
                "flag": "-F",
                "long": null,
                "arg": "<file>",
                "description": "Read the commit log message from the given file. Use - to read from the standard input. This can be given more than once and the content of each file becomes its own paragraph. -S[<keyid>], --gpg-sign[=<keyid>], --no-gpg-sign GPG-sign commits. The keyid argument is optional and defaults to the committer identity; if specified, it must be stuck to the option without a space. --no-gpg-sign is useful to countermand a --gpg-sign option given earlier on the command line."
            }
        ],
        "examples": [],
        "see_also": [
            {
                "name": "git-write-tree",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/git-write-tree/1/json"
            },
            {
                "name": "git-commit",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/git-commit/1/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 20,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 3,
                "subsections": [
                    {
                        "name": "-p <parent>",
                        "lines": 2,
                        "flag": "-p",
                        "arg": "<parent>"
                    },
                    {
                        "name": "-m <message>",
                        "lines": 3,
                        "flag": "-m",
                        "arg": "<message>"
                    },
                    {
                        "name": "-F <file>",
                        "lines": 8,
                        "flag": "-F",
                        "arg": "<file>"
                    }
                ]
            },
            {
                "name": "COMMIT INFORMATION",
                "lines": 11,
                "subsections": []
            },
            {
                "name": "DATE FORMATS",
                "lines": 22,
                "subsections": []
            },
            {
                "name": "DISCUSSION",
                "lines": 53,
                "subsections": []
            },
            {
                "name": "FILES",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "GIT",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "git-commit-tree - Create a new commit object\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "git commit-tree <tree> [(-p <parent>)...]\ngit commit-tree [(-p <parent>)...] [-S[<keyid>]] [(-m <message>)...]\n[(-F <file>)...] <tree>\n\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This is usually not what an end user wants to run directly. See git-commit(1) instead.\n\nCreates a new commit object based on the provided tree object and emits the new commit object\nid on stdout. The log message is read from the standard input, unless -m or -F options are\ngiven.\n\nThe -m and -F options can be given any number of times, in any order. The commit log message\nwill be composed in the order in which the options are given.\n\nA commit object may have any number of parents. With exactly one parent, it is an ordinary\ncommit. Having more than one parent makes the commit a merge between several lines of\nhistory. Initial (root) commits have no parents.\n\nWhile a tree represents a particular directory state of a working directory, a commit\nrepresents that state in \"time\", and explains how to get there.\n\nNormally a commit would identify a new \"HEAD\" state, and while Git doesn’t care where you\nsave the note about that state, in practice we tend to just write the result to the file that\nis pointed at by .git/HEAD, so that we can always see what the last committed state was.\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "<tree>\nAn existing tree object.\n",
                "subsections": [
                    {
                        "name": "-p <parent>",
                        "content": "Each -p indicates the id of a parent commit object.\n",
                        "flag": "-p",
                        "arg": "<parent>"
                    },
                    {
                        "name": "-m <message>",
                        "content": "A paragraph in the commit log message. This can be given more than once and each\n<message> becomes its own paragraph.\n",
                        "flag": "-m",
                        "arg": "<message>"
                    },
                    {
                        "name": "-F <file>",
                        "content": "Read the commit log message from the given file. Use - to read from the standard input.\nThis can be given more than once and the content of each file becomes its own paragraph.\n\n-S[<keyid>], --gpg-sign[=<keyid>], --no-gpg-sign\nGPG-sign commits. The keyid argument is optional and defaults to the committer identity;\nif specified, it must be stuck to the option without a space.  --no-gpg-sign is useful to\ncountermand a --gpg-sign option given earlier on the command line.\n",
                        "flag": "-F",
                        "arg": "<file>"
                    }
                ]
            },
            "COMMIT INFORMATION": {
                "content": "A commit encapsulates:\n\n•   all parent object ids\n\n•   author name, email and date\n\n•   committer name and email and the commit time.\n\nA commit comment is read from stdin. If a changelog entry is not provided via \"<\"\nredirection, git commit-tree will just wait for one to be entered and terminated with ^D.\n",
                "subsections": []
            },
            "DATE FORMATS": {
                "content": "The GITAUTHORDATE and GITCOMMITTERDATE environment variables support the following date\nformats:\n\nGit internal format\nIt is <unix timestamp> <time zone offset>, where <unix timestamp> is the number of\nseconds since the UNIX epoch.  <time zone offset> is a positive or negative offset from\nUTC. For example CET (which is 1 hour ahead of UTC) is +0100.\n\nRFC 2822\nThe standard email format as described by RFC 2822, for example Thu, 07 Apr 2005 22:13:13\n+0200.\n\nISO 8601\nTime and date specified by the ISO 8601 standard, for example 2005-04-07T22:13:13. The\nparser accepts a space instead of the T character as well. Fractional parts of a second\nwill be ignored, for example 2005-04-07T22:13:13.019 will be treated as\n2005-04-07T22:13:13.\n\nNote\nIn addition, the date part is accepted in the following formats: YYYY.MM.DD,\nMM/DD/YYYY and DD.MM.YYYY.\n",
                "subsections": []
            },
            "DISCUSSION": {
                "content": "Git is to some extent character encoding agnostic.\n\n•   The contents of the blob objects are uninterpreted sequences of bytes. There is no\nencoding translation at the core level.\n\n•   Path names are encoded in UTF-8 normalization form C. This applies to tree objects, the\nindex file, ref names, as well as path names in command line arguments, environment\nvariables and config files (.git/config (see git-config(1)), gitignore(5),\ngitattributes(5) and gitmodules(5)).\n\nNote that Git at the core level treats path names simply as sequences of non-NUL bytes,\nthere are no path name encoding conversions (except on Mac and Windows). Therefore, using\nnon-ASCII path names will mostly work even on platforms and file systems that use legacy\nextended ASCII encodings. However, repositories created on such systems will not work\nproperly on UTF-8-based systems (e.g. Linux, Mac, Windows) and vice versa. Additionally,\nmany Git-based tools simply assume path names to be UTF-8 and will fail to display other\nencodings correctly.\n\n•   Commit log messages are typically encoded in UTF-8, but other extended ASCII encodings\nare also supported. This includes ISO-8859-x, CP125x and many others, but not UTF-16/32,\nEBCDIC and CJK multi-byte encodings (GBK, Shift-JIS, Big5, EUC-x, CP9xx etc.).\n\nAlthough we encourage that the commit log messages are encoded in UTF-8, both the core and\nGit Porcelain are designed not to force UTF-8 on projects. If all participants of a\nparticular project find it more convenient to use legacy encodings, Git does not forbid it.\nHowever, there are a few things to keep in mind.\n\n1. git commit and git commit-tree issues a warning if the commit log message given to it\ndoes not look like a valid UTF-8 string, unless you explicitly say your project uses a\nlegacy encoding. The way to say this is to have i18n.commitEncoding in .git/config file,\nlike this:\n\n[i18n]\ncommitEncoding = ISO-8859-1\n\nCommit objects created with the above setting record the value of i18n.commitEncoding in\nits encoding header. This is to help other people who look at them later. Lack of this\nheader implies that the commit log message is encoded in UTF-8.\n\n2. git log, git show, git blame and friends look at the encoding header of a commit object,\nand try to re-code the log message into UTF-8 unless otherwise specified. You can specify\nthe desired output encoding with i18n.logOutputEncoding in .git/config file, like this:\n\n[i18n]\nlogOutputEncoding = ISO-8859-1\n\nIf you do not have this configuration variable, the value of i18n.commitEncoding is used\ninstead.\n\nNote that we deliberately chose not to re-code the commit log message when a commit is made\nto force UTF-8 at the commit object level, because re-coding to UTF-8 is not necessarily a\nreversible operation.\n",
                "subsections": []
            },
            "FILES": {
                "content": "/etc/mailname\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "git-write-tree(1) git-commit(1)\n",
                "subsections": []
            },
            "GIT": {
                "content": "Part of the git(1) suite\n\n\n\nGit 2.34.1                                   02/26/2026                           GIT-COMMIT-TREE(1)",
                "subsections": []
            }
        }
    }
}