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