git-commit-tree
Create a commit object from a tree
TLDR
SYNOPSIS
git commit-tree tree [options]
DESCRIPTION
git commit-tree is a low-level plumbing command that creates a new commit object directly from a tree object hash. Unlike git commit (a porcelain command), this bypasses the index and working directory, operating directly on Git's internal object database.This command is used internally by git commit but is also available for advanced scenarios like repository surgery, history reconstruction, or programmatic commit creation. It requires providing a tree hash (typically created by git write-tree or extracted from existing commits) and accepts optional parent commit hashes to establish lineage.Multiple -p options create merge commits with multiple parents. The commit message can be provided inline with -m, read from a file with -F, or piped to stdin. Author and committer information come from git config unless overridden with environment variables (GITAUTHORNAME, GITCOMMITTERDATE, etc.).This command outputs the SHA-1 hash of the newly created commit object. To make the commit visible, you typically need to update a branch reference using git update-ref or git reset. Most users never need this command directly, but it's essential for understanding Git's internal architecture and for advanced repository manipulation.
PARAMETERS
-p parent
Parent commit.-m message
A paragraph in the commit log message. Can be given more than once; each becomes its own paragraph.-F file
Read the commit log message from the given file. Use - to read from stdin. Can be given more than once.-S[keyid]
GPG sign commit. The keyid is optional and defaults to the committer identity; if specified, it must be attached to the option without a space.--no-gpg-sign
Countermand a previous --gpg-sign option.
SEE ALSO
git-commit(1), git-write-tree(1), git-update-ref(1)
