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>)...] < changelog
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>]
52 GPG-sign commit.
53
55 A commit encapsulates:
56
57 · all parent object ids
58
59 · author name, email and date
60
61 · committer name and email and the commit time.
62
63 While parent object ids are provided on the command line, author and
64 committer information is taken from the following environment
65 variables, if set:
66
67 GIT_AUTHOR_NAME
68 GIT_AUTHOR_EMAIL
69 GIT_AUTHOR_DATE
70 GIT_COMMITTER_NAME
71 GIT_COMMITTER_EMAIL
72 GIT_COMMITTER_DATE
73
74 (nb "<", ">" and "\n"s are stripped)
75
76 In case (some of) these environment variables are not set, the
77 information is taken from the configuration items user.name and
78 user.email, or, if not present, the environment variable EMAIL, or, if
79 that is not set, system user name and the hostname used for outgoing
80 mail (taken from /etc/mailname and falling back to the fully qualified
81 hostname when that file does not exist).
82
83 A commit comment is read from stdin. If a changelog entry is not
84 provided via "<" redirection, git commit-tree will just wait for one to
85 be entered and terminated with ^D.
86
88 The GIT_AUTHOR_DATE, GIT_COMMITTER_DATE environment variables support
89 the following date formats:
90
91 Git internal format
92 It is <unix timestamp> <timezone offset>, where <unix timestamp> is
93 the number of seconds since the UNIX epoch. <timezone offset> is a
94 positive or negative offset from UTC. For example CET (which is 2
95 hours ahead UTC) is +0200.
96
97 RFC 2822
98 The standard email format as described by RFC 2822, for example
99 Thu, 07 Apr 2005 22:13:13 +0200.
100
101 ISO 8601
102 Time and date specified by the ISO 8601 standard, for example
103 2005-04-07T22:13:13. The parser accepts a space instead of the T
104 character as well.
105
106 Note
107 In addition, the date part is accepted in the following
108 formats: YYYY.MM.DD, MM/DD/YYYY and DD.MM.YYYY.
109
111 At the core level, Git is character encoding agnostic.
112
113 · The pathnames recorded in the index and in the tree objects are
114 treated as uninterpreted sequences of non-NUL bytes. What
115 readdir(2) returns are what are recorded and compared with the data
116 Git keeps track of, which in turn are expected to be what lstat(2)
117 and creat(2) accepts. There is no such thing as pathname encoding
118 translation.
119
120 · The contents of the blob objects are uninterpreted sequences of
121 bytes. There is no encoding translation at the core level.
122
123 · The commit log messages are uninterpreted sequences of non-NUL
124 bytes.
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)
167
169 Part of the git(1) suite
170
171
172
173Git 1.8.3.1 11/19/2018 GIT-COMMIT-TREE(1)