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 commit>]\* < changelog
10
12 This is usually not what an end user wants to run directly. See git-
13 commit(1) instead.
14
15 Creates a new commit object based on the provided tree object and emits
16 the new commit object id on stdout.
17
18 A commit object may have any number of parents. With exactly one
19 parent, it is an ordinary commit. Having more than one parent makes the
20 commit a merge between several lines of history. Initial (root) commits
21 have no parents.
22
23 While a tree represents a particular directory state of a working
24 directory, a commit represents that state in "time", and explains how
25 to get there.
26
27 Normally a commit would identify a new "HEAD" state, and while git
28 doesn’t care where you save the note about that state, in practice we
29 tend to just write the result to the file that is pointed at by
30 .git/HEAD, so that we can always see what the last committed state was.
31
33 <tree>
34 An existing tree object
35
36 -p <parent commit>
37 Each -p indicates the id of a parent commit object.
38
40 A commit encapsulates:
41
42 · all parent object ids
43
44 · author name, email and date
45
46 · committer name and email and the commit time.
47
48 While parent object ids are provided on the command line, author and
49 committer information is taken from the following environment
50 variables, if set:
51
52 GIT_AUTHOR_NAME
53 GIT_AUTHOR_EMAIL
54 GIT_AUTHOR_DATE
55 GIT_COMMITTER_NAME
56 GIT_COMMITTER_EMAIL
57 GIT_COMMITTER_DATE
58 EMAIL
59
60 (nb "<", ">" and "\n"s are stripped)
61
62 In case (some of) these environment variables are not set, the
63 information is taken from the configuration items user.name and
64 user.email, or, if not present, system user name and fully qualified
65 hostname.
66
67 A commit comment is read from stdin. If a changelog entry is not
68 provided via "<" redirection, git commit-tree will just wait for one to
69 be entered and terminated with ^D.
70
72 The GIT_AUTHOR_DATE, GIT_COMMITTER_DATE environment variables support
73 the following date formats:
74
75 Git internal format
76 It is <unix timestamp> <timezone offset>, where <unix timestamp> is
77 the number of seconds since the UNIX epoch. <timezone offset> is a
78 positive or negative offset from UTC. For example CET (which is 2
79 hours ahead UTC) is +0200.
80
81 RFC 2822
82 The standard email format as described by RFC 2822, for example
83 Thu, 07 Apr 2005 22:13:13 +0200.
84
85 ISO 8601
86 Time and date specified by the ISO 8601 standard, for example
87 2005-04-07T22:13:13. The parser accepts a space instead of the T
88 character as well.
89
90 Note
91 In addition, the date part is accepted in the following
92 formats: YYYY.MM.DD, MM/DD/YYYY and DD.MM.YYYY.
93
95 You don’t exist. Go away!
96 The passwd(5) gecos field couldn’t be read
97
98 Your parents must have hated you!
99 The passwd(5) gecos field is longer than a giant static buffer.
100
101 Your sysadmin must hate you!
102 The passwd(5) name field is longer than a giant static buffer.
103
105 At the core level, git is character encoding agnostic.
106
107 · The pathnames recorded in the index and in the tree objects are
108 treated as uninterpreted sequences of non-NUL bytes. What
109 readdir(2) returns are what are recorded and compared with the data
110 git keeps track of, which in turn are expected to be what lstat(2)
111 and creat(2) accepts. There is no such thing as pathname encoding
112 translation.
113
114 · The contents of the blob objects are uninterpreted sequences of
115 bytes. There is no encoding translation at the core level.
116
117 · The commit log messages are uninterpreted sequences of non-NUL
118 bytes.
119
120 Although we encourage that the commit log messages are encoded in
121 UTF-8, both the core and git Porcelain are designed not to force UTF-8
122 on projects. If all participants of a particular project find it more
123 convenient to use legacy encodings, git does not forbid it. However,
124 there are a few things to keep in mind.
125
126 1. git commit and git commit-tree issues a warning if the commit log
127 message given to it does not look like a valid UTF-8 string, unless
128 you explicitly say your project uses a legacy encoding. The way to
129 say this is to have i18n.commitencoding in .git/config file, like
130 this:
131
132 [i18n]
133 commitencoding = ISO-8859-1
134
135 Commit objects created with the above setting record the value of
136 i18n.commitencoding in its encoding header. This is to help other
137 people who look at them later. Lack of this header implies that the
138 commit log message is encoded in UTF-8.
139
140 2. git log, git show, git blame and friends look at the encoding
141 header of a commit object, and try to re-code the log message into
142 UTF-8 unless otherwise specified. You can specify the desired
143 output encoding with i18n.logoutputencoding in .git/config file,
144 like this:
145
146 [i18n]
147 logoutputencoding = ISO-8859-1
148
149 If you do not have this configuration variable, the value of
150 i18n.commitencoding is used instead.
151
152 Note that we deliberately chose not to re-code the commit log message
153 when a commit is made to force UTF-8 at the commit object level,
154 because re-coding to UTF-8 is not necessarily a reversible operation.
155
157 git-write-tree(1)
158
160 Written by Linus Torvalds <torvalds@osdl.org[1]>
161
163 Documentation by David Greaves, Junio C Hamano and the git-list
164 <git@vger.kernel.org[2]>.
165
167 Part of the git(1) suite
168
170 1. torvalds@osdl.org
171 mailto:torvalds@osdl.org
172
173 2. git@vger.kernel.org
174 mailto:git@vger.kernel.org
175
176
177
178Git 1.7.1 08/16/2017 GIT-COMMIT-TREE(1)