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>], --no-gpg-sign
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. --no-gpg-sign is useful to countermand a
59 --gpg-sign option given earlier on the command line.
60
62 A commit encapsulates:
63
64 • all parent object ids
65
66 • author name, email and date
67
68 • committer name and email and the commit time.
69
70 A commit comment is read from stdin. If a changelog entry is not
71 provided via "<" redirection, git commit-tree will just wait for one to
72 be entered and terminated with ^D.
73
75 The GIT_AUTHOR_DATE and GIT_COMMITTER_DATE environment variables
76 support the following date formats:
77
78 Git internal format
79 It is <unix-timestamp> <time-zone-offset>, where <unix-timestamp>
80 is the number of seconds since the UNIX epoch. <time-zone-offset>
81 is a positive or negative offset from UTC. For example CET (which
82 is 1 hour ahead of UTC) is +0100.
83
84 RFC 2822
85 The standard email format as described by RFC 2822, for example
86 Thu, 07 Apr 2005 22:13:13 +0200.
87
88 ISO 8601
89 Time and date specified by the ISO 8601 standard, for example
90 2005-04-07T22:13:13. The parser accepts a space instead of the T
91 character as well. Fractional parts of a second will be ignored,
92 for example 2005-04-07T22:13:13.019 will be treated as
93 2005-04-07T22:13:13.
94
95 Note
96 In addition, the date part is accepted in the following
97 formats: YYYY.MM.DD, MM/DD/YYYY and DD.MM.YYYY.
98
100 Git is to some extent character encoding agnostic.
101
102 • The contents of the blob objects are uninterpreted sequences of
103 bytes. There is no encoding translation at the core level.
104
105 • Path names are encoded in UTF-8 normalization form C. This applies
106 to tree objects, the index file, ref names, as well as path names
107 in command line arguments, environment variables and config files
108 (.git/config (see git-config(1)), gitignore(5), gitattributes(5)
109 and gitmodules(5)).
110
111 Note that Git at the core level treats path names simply as
112 sequences of non-NUL bytes, there are no path name encoding
113 conversions (except on Mac and Windows). Therefore, using non-ASCII
114 path names will mostly work even on platforms and file systems that
115 use legacy extended ASCII encodings. However, repositories created
116 on such systems will not work properly on UTF-8-based systems (e.g.
117 Linux, Mac, Windows) and vice versa. Additionally, many Git-based
118 tools simply assume path names to be UTF-8 and will fail to display
119 other encodings correctly.
120
121 • Commit log messages are typically encoded in UTF-8, but other
122 extended ASCII encodings are also supported. This includes
123 ISO-8859-x, CP125x and many others, but not UTF-16/32, EBCDIC and
124 CJK multi-byte encodings (GBK, Shift-JIS, Big5, EUC-x, CP9xx etc.).
125
126 Although we encourage that the commit log messages are encoded in
127 UTF-8, both the core and Git Porcelain are designed not to force UTF-8
128 on projects. If all participants of a particular project find it more
129 convenient to use legacy encodings, Git does not forbid it. However,
130 there are a few things to keep in mind.
131
132 1. git commit and git commit-tree issues a warning if the commit log
133 message given to it does not look like a valid UTF-8 string, unless
134 you explicitly say your project uses a legacy encoding. The way to
135 say this is to have i18n.commitEncoding in .git/config file, like
136 this:
137
138 [i18n]
139 commitEncoding = ISO-8859-1
140
141 Commit objects created with the above setting record the value of
142 i18n.commitEncoding in its encoding header. This is to help other
143 people who look at them later. Lack of this header implies that the
144 commit log message is encoded in UTF-8.
145
146 2. git log, git show, git blame and friends look at the encoding
147 header of a commit object, and try to re-code the log message into
148 UTF-8 unless otherwise specified. You can specify the desired
149 output encoding with i18n.logOutputEncoding in .git/config file,
150 like this:
151
152 [i18n]
153 logOutputEncoding = ISO-8859-1
154
155 If you do not have this configuration variable, the value of
156 i18n.commitEncoding is used instead.
157
158 Note that we deliberately chose not to re-code the commit log message
159 when a commit is made to force UTF-8 at the commit object level,
160 because re-coding to UTF-8 is not necessarily a reversible operation.
161
163 /etc/mailname
164
166 git-write-tree(1) git-commit(1)
167
169 Part of the git(1) suite
170
171
172
173Git 2.39.1 2023-01-13 GIT-COMMIT-TREE(1)