<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sect2 SYSTEM "../../../dtd/dblite.dtd">

<sect2 lang="en" id="git-commit-tree(1)">
    <title>git-commit-tree(1)</title>
    <date>2024-07-02</date>
<revhistory><revision><date>2024-07-02</date></revision></revhistory>
<indexterm>
<primary>git-commit-tree(1)</primary>
</indexterm>
<simplesect id="git-commit-tree(1)__name">
<title>NAME</title>
<simpara>git-commit-tree - Create a new commit object</simpara>
</simplesect>
<simplesect id="git-commit-tree(1)__synopsis">
<title>SYNOPSIS</title>
<blockquote>
<literallayout><emphasis>git commit-tree</emphasis> &lt;tree&gt; [(-p &lt;parent&gt;)&#8230;]
<emphasis>git commit-tree</emphasis> [(-p &lt;parent&gt;)&#8230;] [-S[&lt;keyid&gt;]] [(-m &lt;message&gt;)&#8230;]
                  [(-F &lt;file&gt;)&#8230;] &lt;tree&gt;</literallayout>
</blockquote>
</simplesect>
<simplesect id="git-commit-tree(1)__description">
<title>DESCRIPTION</title>
<simpara>This is usually not what an end user wants to run directly.  See
<xref linkend="git-commit(1)" /> instead.</simpara>
<simpara>Creates a new commit object based on the provided tree object and
emits the new commit object id on stdout. The log message is read
from the standard input, unless <emphasis>-m</emphasis> or <emphasis>-F</emphasis> options are given.</simpara>
<simpara>The <emphasis>-m</emphasis> and <emphasis>-F</emphasis> options can be given any number of times, in any
order. The commit log message will be composed in the order in which
the options are given.</simpara>
<simpara>A commit object may have any number of parents. With exactly one
parent, it is an ordinary commit. Having more than one parent makes
the commit a merge between several lines of history. Initial (root)
commits have no parents.</simpara>
<simpara>While a tree represents a particular directory state of a working
directory, a commit represents that state in "time", and explains how
to get there.</simpara>
<simpara>Normally a commit would identify a new "HEAD" state, and while Git
doesn't care where you save the note about that state, in practice we
tend to just write the result to the file that is pointed at by
<emphasis>.git/HEAD</emphasis>, so that we can always see what the last committed
state was.</simpara>
</simplesect>
<simplesect id="git-commit-tree(1)__options">
<title>OPTIONS</title>
<variablelist>
<varlistentry>
<term>
&lt;tree&gt;
</term>
<listitem>
<simpara>
        An existing tree object.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-p &lt;parent&gt;
</term>
<listitem>
<simpara>
        Each <emphasis>-p</emphasis> indicates the id of a parent commit object.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-m &lt;message&gt;
</term>
<listitem>
<simpara>
        A paragraph in the commit log message. This can be given more than
        once and each &lt;message&gt; becomes its own paragraph.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-F &lt;file&gt;
</term>
<listitem>
<simpara>
        Read the commit log message from the given file. Use <emphasis>-</emphasis> to read
        from the standard input. This can be given more than once and the
        content of each file becomes its own paragraph.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-S[&lt;keyid&gt;]
</term>
<term>
--gpg-sign[=&lt;keyid&gt;]
</term>
<term>
--no-gpg-sign
</term>
<listitem>
<simpara>
        GPG-sign commits. The <emphasis>keyid</emphasis> argument is optional and
        defaults to the committer identity; if specified, it must be
        stuck to the option without a space. <emphasis>--no-gpg-sign</emphasis> is useful to
        countermand a <emphasis>--gpg-sign</emphasis> option given earlier on the command line.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</simplesect>
<simplesect id="git-commit-tree(1)__commit_information">
<title>Commit Information</title>
<simpara>A commit encapsulates:</simpara>
<itemizedlist>
<listitem>
<simpara>
all parent object ids
</simpara>
</listitem>
<listitem>
<simpara>
author name, email and date
</simpara>
</listitem>
<listitem>
<simpara>
committer name and email and the commit time.
</simpara>
</listitem>
</itemizedlist>
<simpara>A commit comment is read from stdin. If a changelog
entry is not provided via "&lt;" redirection, <emphasis>git commit-tree</emphasis> will just wait
for one to be entered and terminated with ^D.</simpara>
</simplesect>
<simplesect id="git-commit-tree(1)__date_formats">
<title>DATE FORMATS</title>
<simpara>The <emphasis>GIT_AUTHOR_DATE</emphasis> and <emphasis>GIT_COMMITTER_DATE</emphasis> environment variables
support the following date formats:</simpara>
<variablelist>
<varlistentry>
<term>
Git internal format
</term>
<listitem>
<simpara>
        It is <emphasis>&lt;unix-timestamp&gt; &lt;time-zone-offset&gt;</emphasis>, where
        <emphasis>&lt;unix-timestamp&gt;</emphasis> is the number of seconds since the UNIX epoch.
        <emphasis>&lt;time-zone-offset&gt;</emphasis> is a positive or negative offset from UTC.
        For example CET (which is 1 hour ahead of UTC) is <emphasis>+0100</emphasis>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
RFC 2822
</term>
<listitem>
<simpara>
        The standard date format as described by RFC 2822, for example
        <emphasis>Thu, 07 Apr 2005 22:13:13 +0200</emphasis>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
ISO 8601
</term>
<listitem>
<simpara>
        Time and date specified by the ISO 8601 standard, for example
        <emphasis>2005-04-07T22:13:13</emphasis>. The parser accepts a space instead of the
        <emphasis>T</emphasis> character as well. Fractional parts of a second will be ignored,
        for example <emphasis>2005-04-07T22:13:13.019</emphasis> will be treated as
        <emphasis>2005-04-07T22:13:13</emphasis>.
</simpara>
<note><simpara>In addition, the date part is accepted in the following formats:
<emphasis>YYYY.MM.DD</emphasis>, <emphasis>MM/DD/YYYY</emphasis> and <emphasis>DD.MM.YYYY</emphasis>.</simpara></note>
</listitem>
</varlistentry>
</variablelist>
</simplesect>
<simplesect id="git-commit-tree(1)__discussion">
<title>Discussion</title>
<simpara>Git is to some extent character encoding agnostic.</simpara>
<itemizedlist>
<listitem>
<simpara>
The contents of the blob objects are uninterpreted sequences
   of bytes.  There is no encoding translation at the core
   level.
</simpara>
</listitem>
<listitem>
<simpara>
Path names are encoded in UTF-8 normalization form C. This
   applies to tree objects, the index file, ref names, as well as
   path names in command line arguments, environment variables
   and config files (<emphasis>.git/config</emphasis> (see <xref linkend="git-config(1)" />),
   <xref linkend="gitignore(5)" />, <xref linkend="gitattributes(5)" /> and
   <xref linkend="gitmodules(5)" />).
</simpara>
<simpara>Note that Git at the core level treats path names simply as
sequences of non-NUL bytes, there are no path name encoding
conversions (except on Mac and Windows). Therefore, using
non-ASCII path names will mostly work even on platforms and file
systems that use legacy extended ASCII encodings. However,
repositories created on such systems will not work properly on
UTF-8-based systems (e.g. Linux, Mac, Windows) and vice versa.
Additionally, many Git-based tools simply assume path names to
be UTF-8 and will fail to display other encodings correctly.</simpara>
</listitem>
<listitem>
<simpara>
Commit log messages are typically encoded in UTF-8, but other
   extended ASCII encodings are also supported. This includes
   ISO-8859-x, CP125x and many others, but <emphasis>not</emphasis> UTF-16/32,
   EBCDIC and CJK multi-byte encodings (GBK, Shift-JIS, Big5,
   EUC-x, CP9xx etc.).
</simpara>
</listitem>
</itemizedlist>
<simpara>Although we encourage that the commit log messages are encoded
in UTF-8, both the core and Git Porcelain are designed not to
force UTF-8 on projects.  If all participants of a particular
project find it more convenient to use legacy encodings, Git
does not forbid it.  However, there are a few things to keep in
mind.</simpara>
<orderedlist numeration="arabic">
<listitem>
<simpara>
<emphasis>git commit</emphasis> and <emphasis>git commit-tree</emphasis> issue
  a warning if the commit log message given to it does not look
  like a valid UTF-8 string, unless you explicitly say your
  project uses a legacy encoding.  The way to say this is to
  have <emphasis>i18n.commitEncoding</emphasis> in <emphasis>.git/config</emphasis> file, like this:
</simpara>
<screen>[i18n]
        commitEncoding = ISO-8859-1</screen>
<simpara>Commit objects created with the above setting record the value
of <emphasis>i18n.commitEncoding</emphasis> in their <emphasis>encoding</emphasis> header.  This is to
help other people who look at them later.  Lack of this header
implies that the commit log message is encoded in UTF-8.</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>git log</emphasis>, <emphasis>git show</emphasis>, <emphasis>git blame</emphasis> and friends look at the
  <emphasis>encoding</emphasis> header of a commit object, and try to re-code the
  log message into UTF-8 unless otherwise specified.  You can
  specify the desired output encoding with
  <emphasis>i18n.logOutputEncoding</emphasis> in <emphasis>.git/config</emphasis> file, like this:
</simpara>
<screen>[i18n]
        logOutputEncoding = ISO-8859-1</screen>
<simpara>If you do not have this configuration variable, the value of
<emphasis>i18n.commitEncoding</emphasis> is used instead.</simpara>
</listitem>
</orderedlist>
<simpara>Note that we deliberately chose not to re-code the commit log
message when a commit is made to force UTF-8 at the commit
object level, because re-coding to UTF-8 is not necessarily a
reversible operation.</simpara>
</simplesect>
<simplesect id="git-commit-tree(1)__files">
<title>FILES</title>
<simpara>/etc/mailname</simpara>
</simplesect>
<simplesect id="git-commit-tree(1)__see_also">
<title>SEE ALSO</title>
<simpara><xref linkend="git-write-tree(1)" />
<xref linkend="git-commit(1)" /></simpara>
</simplesect>
<simplesect id="git-commit-tree(1)__git">
<title>GIT</title>
<simpara>Part of the <xref linkend="git(1)" /> suite</simpara>
</simplesect>
</sect2>
