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