man-pages/man1/git-commit-tree.1.html
2021-03-31 01:06:50 +01:00

353 lines
9.0 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of GIT-COMMIT-TREE</TITLE>
</HEAD><BODY>
<H1>GIT-COMMIT-TREE</H1>
Section: Git Manual (1)<BR>Updated: 03/04/2021<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
git-commit-tree - Create a new commit object
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<P>
<PRE>
<I>git commit-tree</I> &lt;tree&gt; [(-p &lt;parent&gt;)...]
<I>git commit-tree</I> [(-p &lt;parent&gt;)...] [-S[&lt;keyid&gt;]] [(-m &lt;message&gt;)...]
[(-F &lt;file&gt;)...] &lt;tree&gt;
</PRE>
<P>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<P>
This is usually not what an end user wants to run directly. See <B><A HREF="/cgi-bin/man/man2html?1+git-commit">git-commit</A></B>(1) instead.
<P>
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 <B>-m</B> or <B>-F</B> options are given.
<P>
The <B>-m</B> and <B>-F</B> 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.
<P>
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.
<P>
While a tree represents a particular directory state of a working directory, a commit represents that state in &quot;time&quot;, and explains how to get there.
<P>
Normally a commit would identify a new &quot;HEAD&quot; 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 <B>.git/HEAD</B>, so that we can always see what the last committed state was.
<A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2>
<P>
&lt;tree&gt;
<DL COMPACT><DT id="1"><DD>
An existing tree object.
</DL>
<P>
-p &lt;parent&gt;
<DL COMPACT><DT id="2"><DD>
Each
<B>-p</B>
indicates the id of a parent commit object.
</DL>
<P>
-m &lt;message&gt;
<DL COMPACT><DT id="3"><DD>
A paragraph in the commit log message. This can be given more than once and each &lt;message&gt; becomes its own paragraph.
</DL>
<P>
-F &lt;file&gt;
<DL COMPACT><DT id="4"><DD>
Read the commit log message from the given file. Use
<B>-</B>
to read from the standard input. This can be given more than once and the content of each file becomes its own paragraph.
</DL>
<P>
-S[&lt;keyid&gt;], --gpg-sign[=&lt;keyid&gt;]
<DL COMPACT><DT id="5"><DD>
GPG-sign commits. The
<B>keyid</B>
argument is optional and defaults to the committer identity; if specified, it must be stuck to the option without a space.
</DL>
<P>
--no-gpg-sign
<DL COMPACT><DT id="6"><DD>
Do not GPG-sign commit, to countermand a
<B>--gpg-sign</B>
option given earlier on the command line.
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>COMMIT INFORMATION</H2>
<P>
A commit encapsulates:
<P>
<DL COMPACT><DT id="7"><DD>
&bull;
all parent object ids
</DL>
<P>
<DL COMPACT><DT id="8"><DD>
&bull;
author name, email and date
</DL>
<P>
<DL COMPACT><DT id="9"><DD>
&bull;
committer name and email and the commit time.
</DL>
<P>
A commit comment is read from stdin. If a changelog entry is not provided via &quot;&lt;&quot; redirection, <I>git commit-tree</I> will just wait for one to be entered and terminated with ^D.
<A NAME="lbAG">&nbsp;</A>
<H2>DATE FORMATS</H2>
<P>
The <B>GIT_AUTHOR_DATE</B>, <B>GIT_COMMITTER_DATE</B> environment variables support the following date formats:
<P>
Git internal format
<DL COMPACT><DT id="10"><DD>
It is
<B>&lt;unix timestamp&gt; &lt;time zone offset&gt;</B>, where
<B>&lt;unix timestamp&gt;</B>
is the number of seconds since the UNIX epoch.
<B>&lt;time zone offset&gt;</B>
is a positive or negative offset from UTC. For example CET (which is 1 hour ahead of UTC) is
<B>+0100</B>.
</DL>
<P>
RFC 2822
<DL COMPACT><DT id="11"><DD>
The standard email format as described by RFC 2822, for example
<B>Thu, 07 Apr 2005 22:13:13 +0200</B>.
</DL>
<P>
ISO 8601
<DL COMPACT><DT id="12"><DD>
Time and date specified by the ISO 8601 standard, for example
<B>2005-04-07T22:13:13</B>. The parser accepts a space instead of the
<B>T</B>
character as well.
<P>
<DL COMPACT><DT id="13"><DD>
<BR>
<FONT SIZE="+1">
<B>Note</B>
</FONT>
<BR>
In addition, the date part is accepted in the following formats:
<B>YYYY.MM.DD</B>,
<B>MM/DD/YYYY</B>
and
<B>DD.MM.YYYY</B>.
<P>
</DL>
</DL>
<A NAME="lbAH">&nbsp;</A>
<H2>DISCUSSION</H2>
<P>
Git is to some extent character encoding agnostic.
<P>
<DL COMPACT><DT id="14"><DD>
&bull;
The contents of the blob objects are uninterpreted sequences of bytes. There is no encoding translation at the core level.
</DL>
<P>
<DL COMPACT><DT id="15"><DD>
&bull;
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 (<B>.git/config</B>
(see
<B><A HREF="/cgi-bin/man/man2html?1+git-config">git-config</A></B>(1)),
<B><A HREF="/cgi-bin/man/man2html?5+gitignore">gitignore</A></B>(5),
<B><A HREF="/cgi-bin/man/man2html?5+gitattributes">gitattributes</A></B>(5)
and
<B><A HREF="/cgi-bin/man/man2html?5+gitmodules">gitmodules</A></B>(5)).
<P>
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.
</DL>
<P>
<DL COMPACT><DT id="16"><DD>
&bull;
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
<I>not</I>
UTF-16/32, EBCDIC and CJK multi-byte encodings (GBK, Shift-JIS, Big5, EUC-x, CP9xx etc.).
</DL>
<P>
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.
<P>
<DL COMPACT><DT id="17"><DD>
1.
<I>git commit</I>
and
<I>git commit-tree</I>
issues 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 i18n.commitencoding in
<B>.git/config</B>
file, like this:
<P>
<DL COMPACT><DT id="18"><DD>
<PRE>
[i18n]
commitEncoding = ISO-8859-1
</PRE>
</DL>
<P>
Commit objects created with the above setting record the value of
<B>i18n.commitEncoding</B>
in its
<B>encoding</B>
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.
</DL>
<P>
<DL COMPACT><DT id="19"><DD>
2.
<I>git log</I>,
<I>git show</I>,
<I>git blame</I>
and friends look at the
<B>encoding</B>
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
<B>i18n.logOutputEncoding</B>
in
<B>.git/config</B>
file, like this:
<P>
<DL COMPACT><DT id="20"><DD>
<PRE>
[i18n]
logOutputEncoding = ISO-8859-1
</PRE>
</DL>
<P>
If you do not have this configuration variable, the value of
<B>i18n.commitEncoding</B>
is used instead.
</DL>
<P>
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.
<A NAME="lbAI">&nbsp;</A>
<H2>FILES</H2>
<P>
/etc/mailname
<A NAME="lbAJ">&nbsp;</A>
<H2>SEE ALSO</H2>
<P>
<B><A HREF="/cgi-bin/man/man2html?1+git-write-tree">git-write-tree</A></B>(1) <B><A HREF="/cgi-bin/man/man2html?1+git-commit">git-commit</A></B>(1)
<A NAME="lbAK">&nbsp;</A>
<H2>GIT</H2>
<P>
Part of the <B><A HREF="/cgi-bin/man/man2html?1+git">git</A></B>(1) suite
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="21"><A HREF="#lbAB">NAME</A><DD>
<DT id="22"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="23"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="24"><A HREF="#lbAE">OPTIONS</A><DD>
<DT id="25"><A HREF="#lbAF">COMMIT INFORMATION</A><DD>
<DT id="26"><A HREF="#lbAG">DATE FORMATS</A><DD>
<DT id="27"><A HREF="#lbAH">DISCUSSION</A><DD>
<DT id="28"><A HREF="#lbAI">FILES</A><DD>
<DT id="29"><A HREF="#lbAJ">SEE ALSO</A><DD>
<DT id="30"><A HREF="#lbAK">GIT</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:13 GMT, March 31, 2021
</BODY>
</HTML>