1CG-COMMIT(1) CG-COMMIT(1)
2
3
4
6 cg-commit - commit changes in the working tree to the repository
7
9 cg-commit [-m MESSAGE]... [-e] [-c COMMIT_ID] [OTHER_OPTIONS] [FILE]...
10 [< MESSAGE]
11
12
14 Commits your changes to the GIT repository. Accepts the commit message
15 from stdin. If the commit message is not modified the commit will be
16 aborted.
17
18 Note that you can undo a commit by the cg-admin-uncommit(1) command,
19 but that is possible only under special circumstances. See the CAVEATS
20 section of its documentation.
21
22
23 Commit author
24 Each commit has two user identification fields - commit author and
25 committer. By default, it is recorded that you authored the commit, but
26 it is considered a good practice to change this to the actual author of
27 the change if you are merely applying someone else's patch. It is
28 always recorded that you were the patch committer.
29
30 The commit author is determined by examining various sources in this
31 order:
32
33
34 · --author (see OPTIONS)
35
36 · GIT_AUTHOR_* (see ENVIRONMENT)
37
38 · Configuration file: you can insert this to .git/config or
39 ~/.gitconfig:
40
41 [user]
42 name = "Your Name"
43 email = "your@email.address.xz"
44
45 · System information: The author name defaults to the GECOS field of
46 your /etc/passwd entry, which is taken almost verbatim. The author
47 email defaults to your username@hostname.domainname (but you should
48 change this to the real email address you use if it is any
49 different).
50
52 --amend
53 Amend the last commit with some additional stuff; this will use
54 your current working copy as the new commit "contents" and
55 otherwise have similar effects as -c HEAD; the new commit will
56 _replace_ the current HEAD - which means that you should read
57 cg-admin-uncommit(1) caveats section. If you want to adjust the
58 log message or authorship information, use it with combination
59 with the -e option.
60
61 --author AUTHOR_STRING
62 Set the commit author information according to the argument
63 instead of your environment, .git/author, or user information.
64
65 The AUTHOR_STRING format is Author Name <author@email> Date. The
66 author name and date is optional, only the email is required to
67 be always present (e.g. --author "<pasky@ucw.cz>" will use the
68 current date and the real name set for your system account
69 (usually in the GECOS field), but a different email address).
70
71 -c COMMIT_ID
72 Copy the commit metainformation from a given commit ID (that is,
73 only the author information and the commit message - NOT
74 committer information and NOT the commit diff). This option is
75 typically used when replaying commits from one lineage or
76 repository to another - see also cg-patch -C (if you want to
77 apply the diffs as well).
78
79 -C Make cg-commit(1) ignore the cache and just commit the thing
80 as-is. Note, this is used internally by Cogito when merging, and
81 it is also useful when you are performing the initial commit
82 manually. This option does not make sense when files are given
83 on the command line.
84
85 -m MESSAGE
86 Specify the commit message, which is used instead of starting up
87 an editor (if the input is not stdin, the input is appended
88 after all the -m messages). Multiple -m parameters are appended
89 to a single commit message, each as separate paragraph.
90
91 -M FILE
92 Include commit message from a file (this has the same effect as
93 if you would cat it to stdin).
94
95 -e Force the editor to be brought up even when -m parameters were
96 passed to cg-commit(1).
97
98 -E Force the editor to be brought up and do the commit even if the
99 default commit message is not changed.
100
101 -f Force the commit even when there's "nothing to commit", that is
102 the tree is the same as the last time you committed, no changes
103 happened. This also forces the commit even if committing is
104 blocked for some reason.
105
106 -N Don't add the files to the object database, just update the
107 caches and the commit information. This is for special purposes
108 when you might not actually _have_ any object database. This
109 option is normally not interesting.
110
111 --no-hooks
112 Do not call any commit hooks during the commit.
113
114 -p, --review
115 Show changes being committed as a patch appended to the commit
116 message buffer. Changes made to the patch will be reapplied
117 before completing the commit. This implies -e.
118
119 -q Be quiet in case there's "nothing to commit", and silently exit
120 returning success. In a sense, this is the opposite to -f.
121
122 -s, --signoff[=STRING]
123 Add Signed-off-by line at the end of the commit message.
124 Optionally, specify the exact name and email to sign off with by
125 passing: --signoff="Author Name <user@example.com>".
126
127 -h, --help
128 Print usage summary.
129
130 --long-help
131 Print user manual. The same as found in cg-commit(1).
132
134 $GIT_DIR/commit-template
135 If the file exists it will be used as a template when creating
136 the commit message. The template file makes it possible to
137 automatically add Signed-off-by line to the log message.
138
139 $GIT_DIR/hooks/commit-post
140 If the file exists and is executable it will be executed upon
141 completion of the commit. The script is passed two arguments.
142 The first argument is the commit ID and the second is the
143 branchname. A sample commit-post script might look like:
144
145 #!/bin/sh
146 id=$1
147 branch=$2
148 echo "Committed $id in $branch" | mail user@host
149
151 See the Commit author section above for details about the
152 name/email/date environment variables meaning and default values.
153
154
155 GIT_AUTHOR_NAME
156 Author's name.
157
158 GIT_AUTHOR_EMAIL
159 Author's e-mail address.
160
161 GIT_AUTHOR_DATE
162 Date, useful when applying patches submitted over e-mail.
163
164 GIT_COMMITTER_NAME
165 Committer's name.
166
167 GIT_COMMITTER_EMAIL
168 Committer's e-mail address. The recommended policy is not to
169 change this, though - it may not be necessarily a valid e-mail
170 address, but its purpose is more to identify the actual user and
171 machine where the commit was done. However, it is obviously
172 ultimately a policy decision of a particular project to
173 determine whether this should be a real e-mail or not.
174
175 GIT_COMMITTER_DATE
176 This is the date of the commit itself. It should be never
177 overridden, unless you know you absolutely need to override it
178 (to ensure the commit gets the same ID as another or when
179 migrating history around).
180
181 EDITOR The editor used for entering revision log information.
182
184 The following GIT configuration file variables are recognized:
185
186
187 user.author, user.email
188 User credentials. See the "Commit author" section for details.
189
190 cogito.hooks.commit.post.allmerged
191 If set to "true" and you are committing a merge, the post-hook
192 will be called for all the merged commits in sequence (the
193 earliest first). Otherwise, the hook will be called only for the
194 merge commit.
195
197 Copyright © Petr Baudis, 2005
198
199
201 cg-commit is part of cogito(7), a toolkit for managing git(7) trees.
202
203
204
205
206 12/11/2006 CG-COMMIT(1)