1GIT-COMMIT-TREE(1) Git Manual GIT-COMMIT-TREE(1)
2
3
4
6 git-commit-tree - Create a new commit object
7
9 git commit-tree <tree> [(-p <parent>)...]
10 git commit-tree [(-p <parent>)...] [-S[<keyid>]] [(-m <message>)...]
11 [(-F <file>)...] <tree>
12
13
15 This is usually not what an end user wants to run directly. See git-
16 commit(1) instead.
17
18 Creates a new commit object based on the provided tree object and emits
19 the new commit object id on stdout. The log message is read from the
20 standard input, unless -m or -F options are given.
21
22 The -m and -F options can be given any number of times, in any order.
23 The commit log message will be composed in the order in which the
24 options are given.
25
26 A commit object may have any number of parents. With exactly one
27 parent, it is an ordinary commit. Having more than one parent makes the
28 commit a merge between several lines of history. Initial (root) commits
29 have no parents.
30
31 While a tree represents a particular directory state of a working
32 directory, a commit represents that state in "time", and explains how
33 to get there.
34
35 Normally a commit would identify a new "HEAD" state, and while Git
36 doesn’t care where you save the note about that state, in practice we
37 tend to just write the result to the file that is pointed at by
38 .git/HEAD, so that we can always see what the last committed state was.
39
41 <tree>
42 An existing tree object.
43
44 -p <parent>
45 Each -p indicates the id of a parent commit object.
46
47 -m <message>
48 A paragraph in the commit log message. This can be given more than
49 once and each <message> becomes its own paragraph.
50
51 -F <file>
52 Read the commit log message from the given file. Use - to read from
53 the standard input. This can be given more than once and the
54 content of each file becomes its own paragraph.
55
56 -S[<keyid>], --gpg-sign[=<keyid>]
57 GPG-sign commits. The keyid argument is optional and defaults to
58 the committer identity; if specified, it must be stuck to the
59 option without a space.
60
61 --no-gpg-sign
62 Do not GPG-sign commit, to countermand a --gpg-sign option given
63 earlier on the command line.
64
66 A commit encapsulates:
67
68 · all parent object ids
69
70 · author name, email and date
71
72 · committer name and email and the commit time.
73
74 While parent object ids are provided on the command line, author and
75 committer information is taken from the following environment
76 variables, if set:
77
78 GIT_AUTHOR_NAME
79 GIT_AUTHOR_EMAIL
80 GIT_AUTHOR_DATE
81 GIT_COMMITTER_NAME
82 GIT_COMMITTER_EMAIL
83 GIT_COMMITTER_DATE
84
85 (nb "<", ">" and "\n"s are stripped)
86
87 In case (some of) these environment variables are not set, the
88 information is taken from the configuration items user.name and
89 user.email, or, if not present, the environment variable EMAIL, or, if
90 that is not set, system user name and the hostname used for outgoing
91 mail (taken from /etc/mailname and falling back to the fully qualified
92 hostname when that file does not exist).
93
94 A commit comment is read from stdin. If a changelog entry is not
95 provided via "<" redirection, git commit-tree will just wait for one to
96 be entered and terminated with ^D.
97
99 The GIT_AUTHOR_DATE, GIT_COMMITTER_DATE environment variables support
100 the following date formats:
101
102 Git internal format
103 It is <unix timestamp> <time zone offset>, where <unix timestamp>
104 is the number of seconds since the UNIX epoch. <time zone offset>
105 is a positive or negative offset from UTC. For example CET (which
106 is 1 hour ahead of UTC) is +0100.
107
108 RFC 2822
109 The standard email format as described by RFC 2822, for example
110 Thu, 07 Apr 2005 22:13:13 +0200.
111
112 ISO 8601
113 Time and date specified by the ISO 8601 standard, for example
114 2005-04-07T22:13:13. The parser accepts a space instead of the T
115 character as well.
116
117 Note
118 In addition, the date part is accepted in the following
119 formats: YYYY.MM.DD, MM/DD/YYYY and DD.MM.YYYY.
120
122 Git is to some extent character encoding agnostic.
123
124 · The contents of the blob objects are uninterpreted sequences of
125 bytes. There is no encoding translation at the core level.
126
127 · Path names are encoded in UTF-8 normalization form C. This applies
128 to tree objects, the index file, ref names, as well as path names
129 in command line arguments, environment variables and config files
130 (.git/config (see git-config(1)), gitignore(5), gitattributes(5)
131 and gitmodules(5)).
132
133 Note that Git at the core level treats path names simply as
134 sequences of non-NUL bytes, there are no path name encoding
135 conversions (except on Mac and Windows). Therefore, using non-ASCII
136 path names will mostly work even on platforms and file systems that
137 use legacy extended ASCII encodings. However, repositories created
138 on such systems will not work properly on UTF-8-based systems (e.g.
139 Linux, Mac, Windows) and vice versa. Additionally, many Git-based
140 tools simply assume path names to be UTF-8 and will fail to display
141 other encodings correctly.
142
143 · Commit log messages are typically encoded in UTF-8, but other
144 extended ASCII encodings are also supported. This includes
145 ISO-8859-x, CP125x and many others, but not UTF-16/32, EBCDIC and
146 CJK multi-byte encodings (GBK, Shift-JIS, Big5, EUC-x, CP9xx etc.).
147
148 Although we encourage that the commit log messages are encoded in
149 UTF-8, both the core and Git Porcelain are designed not to force UTF-8
150 on projects. If all participants of a particular project find it more
151 convenient to use legacy encodings, Git does not forbid it. However,
152 there are a few things to keep in mind.
153
154 1. git commit and git commit-tree issues a warning if the commit log
155 message given to it does not look like a valid UTF-8 string, unless
156 you explicitly say your project uses a legacy encoding. The way to
157 say this is to have i18n.commitencoding in .git/config file, like
158 this:
159
160 [i18n]
161 commitEncoding = ISO-8859-1
162
163 Commit objects created with the above setting record the value of
164 i18n.commitEncoding in its encoding header. This is to help other
165 people who look at them later. Lack of this header implies that the
166 commit log message is encoded in UTF-8.
167
168 2. git log, git show, git blame and friends look at the encoding
169 header of a commit object, and try to re-code the log message into
170 UTF-8 unless otherwise specified. You can specify the desired
171 output encoding with i18n.logOutputEncoding in .git/config file,
172 like this:
173
174 [i18n]
175 logOutputEncoding = ISO-8859-1
176
177 If you do not have this configuration variable, the value of
178 i18n.commitEncoding is used instead.
179
180 Note that we deliberately chose not to re-code the commit log message
181 when a commit is made to force UTF-8 at the commit object level,
182 because re-coding to UTF-8 is not necessarily a reversible operation.
183
185 /etc/mailname
186
188 git-write-tree(1)
189
191 Part of the git(1) suite
192
193
194
195Git 2.24.1 12/10/2019 GIT-COMMIT-TREE(1)