blob: 3d26cd99352d28c5bd0039b8931c687ca6c8d434 [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Junio C Hamano7bd050f2011-09-22 06:32:226<meta name="generator" content="AsciiDoc 8.5.2" />
Junio C Hamano60186642010-12-02 14:18:267<title>git-commit(1)</title>
Junio C Hamano1a4e8412005-12-27 08:17:238<style type="text/css">
9/* Debug borders */
10p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
11/*
12 border: 1px solid red;
13*/
14}
15
16body {
17 margin: 1em 5% 1em 5%;
18}
19
Junio C Hamanoba4b9282008-07-06 05:20:3120a {
21 color: blue;
22 text-decoration: underline;
23}
24a:visited {
25 color: fuchsia;
26}
Junio C Hamano1a4e8412005-12-27 08:17:2327
28em {
29 font-style: italic;
Junio C Hamano60186642010-12-02 14:18:2630 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:2331}
32
33strong {
34 font-weight: bold;
Junio C Hamano60186642010-12-02 14:18:2635 color: #083194;
Junio C Hamano1a4e8412005-12-27 08:17:2336}
37
38tt {
39 color: navy;
40}
41
42h1, h2, h3, h4, h5, h6 {
43 color: #527bbd;
44 font-family: sans-serif;
45 margin-top: 1.2em;
46 margin-bottom: 0.5em;
47 line-height: 1.3;
48}
49
Junio C Hamanoba4b9282008-07-06 05:20:3150h1, h2, h3 {
Junio C Hamano1a4e8412005-12-27 08:17:2351 border-bottom: 2px solid silver;
52}
53h2 {
Junio C Hamano1a4e8412005-12-27 08:17:2354 padding-top: 0.5em;
55}
Junio C Hamanoba4b9282008-07-06 05:20:3156h3 {
57 float: left;
58}
59h3 + * {
60 clear: left;
61}
Junio C Hamano1a4e8412005-12-27 08:17:2362
63div.sectionbody {
64 font-family: serif;
65 margin-left: 0;
66}
67
68hr {
69 border: 1px solid silver;
70}
71
72p {
73 margin-top: 0.5em;
74 margin-bottom: 0.5em;
75}
76
Junio C Hamano60186642010-12-02 14:18:2677ul, ol, li > p {
78 margin-top: 0;
79}
80
Junio C Hamano1a4e8412005-12-27 08:17:2381pre {
82 padding: 0;
83 margin: 0;
84}
85
86span#author {
87 color: #527bbd;
88 font-family: sans-serif;
89 font-weight: bold;
Junio C Hamanoba4b9282008-07-06 05:20:3190 font-size: 1.1em;
Junio C Hamano1a4e8412005-12-27 08:17:2391}
92span#email {
93}
Junio C Hamano60186642010-12-02 14:18:2694span#revnumber, span#revdate, span#revremark {
Junio C Hamano1a4e8412005-12-27 08:17:2395 font-family: sans-serif;
96}
97
98div#footer {
99 font-family: sans-serif;
100 font-size: small;
101 border-top: 2px solid silver;
102 padding-top: 0.5em;
103 margin-top: 4.0em;
104}
105div#footer-text {
106 float: left;
107 padding-bottom: 0.5em;
108}
109div#footer-badges {
110 float: right;
111 padding-bottom: 0.5em;
112}
113
Junio C Hamano60186642010-12-02 14:18:26114div#preamble {
115 margin-top: 1.5em;
116 margin-bottom: 1.5em;
117}
Junio C Hamano1a4e8412005-12-27 08:17:23118div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
119div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
120div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22121 margin-top: 1.0em;
Junio C Hamano1a4e8412005-12-27 08:17:23122 margin-bottom: 1.5em;
123}
124div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22125 margin-top: 2.0em;
126 margin-bottom: 2.0em;
127 margin-right: 10%;
128 color: #606060;
Junio C Hamano1a4e8412005-12-27 08:17:23129}
130
131div.content { /* Block element content. */
132 padding: 0;
133}
134
135/* Block element titles. */
136div.title, caption.title {
Junio C Hamano60186642010-12-02 14:18:26137 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23138 font-family: sans-serif;
139 font-weight: bold;
140 text-align: left;
141 margin-top: 1.0em;
142 margin-bottom: 0.5em;
143}
144div.title + * {
145 margin-top: 0;
146}
147
148td div.title:first-child {
149 margin-top: 0.0em;
150}
151div.content div.title:first-child {
152 margin-top: 0.0em;
153}
154div.content + div.title {
155 margin-top: 0.0em;
156}
157
158div.sidebarblock > div.content {
159 background: #ffffee;
160 border: 1px solid silver;
161 padding: 0.5em;
162}
163
164div.listingblock > div.content {
165 border: 1px solid silver;
166 background: #f4f4f4;
167 padding: 0.5em;
168}
169
Junio C Hamano7bd050f2011-09-22 06:32:22170div.quoteblock, div.verseblock {
171 padding-left: 1.0em;
172 margin-left: 1.0em;
Junio C Hamano60186642010-12-02 14:18:26173 margin-right: 10%;
Junio C Hamano7bd050f2011-09-22 06:32:22174 border-left: 5px solid #dddddd;
175 color: #777777;
Junio C Hamano1a4e8412005-12-27 08:17:23176}
Junio C Hamano7bd050f2011-09-22 06:32:22177
Junio C Hamano60186642010-12-02 14:18:26178div.quoteblock > div.attribution {
179 padding-top: 0.5em;
Junio C Hamano1a4e8412005-12-27 08:17:23180 text-align: right;
181}
Junio C Hamano60186642010-12-02 14:18:26182
Junio C Hamano60186642010-12-02 14:18:26183div.verseblock > div.content {
184 white-space: pre;
185}
186div.verseblock > div.attribution {
187 padding-top: 0.75em;
188 text-align: left;
189}
190/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
Junio C Hamanoba4b9282008-07-06 05:20:31191div.verseblock + div.attribution {
192 text-align: left;
193}
Junio C Hamano1a4e8412005-12-27 08:17:23194
195div.admonitionblock .icon {
196 vertical-align: top;
197 font-size: 1.1em;
198 font-weight: bold;
199 text-decoration: underline;
200 color: #527bbd;
201 padding-right: 0.5em;
202}
203div.admonitionblock td.content {
204 padding-left: 0.5em;
Junio C Hamano7bd050f2011-09-22 06:32:22205 border-left: 3px solid #dddddd;
Junio C Hamano1a4e8412005-12-27 08:17:23206}
207
208div.exampleblock > div.content {
Junio C Hamano7bd050f2011-09-22 06:32:22209 border-left: 3px solid #dddddd;
210 padding-left: 0.5em;
Junio C Hamano1a4e8412005-12-27 08:17:23211}
212
Junio C Hamano1a4e8412005-12-27 08:17:23213div.imageblock div.content { padding-left: 0; }
Junio C Hamano1a4e8412005-12-27 08:17:23214span.image img { border-style: none; }
Junio C Hamano60186642010-12-02 14:18:26215a.image:visited { color: white; }
Junio C Hamano1a4e8412005-12-27 08:17:23216
217dl {
218 margin-top: 0.8em;
219 margin-bottom: 0.8em;
220}
221dt {
222 margin-top: 0.5em;
223 margin-bottom: 0;
Junio C Hamano60186642010-12-02 14:18:26224 font-style: normal;
225 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23226}
227dd > *:first-child {
Junio C Hamano60186642010-12-02 14:18:26228 margin-top: 0.1em;
Junio C Hamano1a4e8412005-12-27 08:17:23229}
230
231ul, ol {
232 list-style-position: outside;
233}
Junio C Hamano60186642010-12-02 14:18:26234ol.arabic {
235 list-style-type: decimal;
236}
237ol.loweralpha {
Junio C Hamano1a4e8412005-12-27 08:17:23238 list-style-type: lower-alpha;
239}
Junio C Hamano60186642010-12-02 14:18:26240ol.upperalpha {
241 list-style-type: upper-alpha;
242}
243ol.lowerroman {
244 list-style-type: lower-roman;
245}
246ol.upperroman {
247 list-style-type: upper-roman;
248}
249
250div.compact ul, div.compact ol,
251div.compact p, div.compact p,
252div.compact div, div.compact div {
253 margin-top: 0.1em;
254 margin-bottom: 0.1em;
255}
Junio C Hamano1a4e8412005-12-27 08:17:23256
257div.tableblock > table {
Junio C Hamanoba4b9282008-07-06 05:20:31258 border: 3px solid #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23259}
Junio C Hamano7bd050f2011-09-22 06:32:22260thead, p.table.header {
Junio C Hamano1a4e8412005-12-27 08:17:23261 font-family: sans-serif;
262 font-weight: bold;
263}
264tfoot {
265 font-weight: bold;
266}
Junio C Hamano60186642010-12-02 14:18:26267td > div.verse {
268 white-space: pre;
269}
270p.table {
271 margin-top: 0;
272}
273/* Because the table frame attribute is overriden by CSS in most browsers. */
274div.tableblock > table[frame="void"] {
275 border-style: none;
276}
277div.tableblock > table[frame="hsides"] {
278 border-left-style: none;
279 border-right-style: none;
280}
281div.tableblock > table[frame="vsides"] {
282 border-top-style: none;
283 border-bottom-style: none;
284}
Junio C Hamano1a4e8412005-12-27 08:17:23285
Junio C Hamano60186642010-12-02 14:18:26286
287div.hdlist {
Junio C Hamano1a4e8412005-12-27 08:17:23288 margin-top: 0.8em;
289 margin-bottom: 0.8em;
290}
Junio C Hamano60186642010-12-02 14:18:26291div.hdlist tr {
292 padding-bottom: 15px;
Junio C Hamanoba4b9282008-07-06 05:20:31293}
Junio C Hamano60186642010-12-02 14:18:26294dt.hdlist1.strong, td.hdlist1.strong {
295 font-weight: bold;
296}
297td.hdlist1 {
Junio C Hamano1a4e8412005-12-27 08:17:23298 vertical-align: top;
Junio C Hamano60186642010-12-02 14:18:26299 font-style: normal;
Junio C Hamano1a4e8412005-12-27 08:17:23300 padding-right: 0.8em;
Junio C Hamano60186642010-12-02 14:18:26301 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23302}
Junio C Hamano60186642010-12-02 14:18:26303td.hdlist2 {
Junio C Hamano1a4e8412005-12-27 08:17:23304 vertical-align: top;
305}
Junio C Hamano60186642010-12-02 14:18:26306div.hdlist.compact tr {
307 margin: 0;
308 padding-bottom: 0;
309}
310
311.comment {
312 background: yellow;
313}
Junio C Hamano1a4e8412005-12-27 08:17:23314
Junio C Hamano7bd050f2011-09-22 06:32:22315.footnote, .footnoteref {
316 font-size: 0.8em;
317}
318
319span.footnote, span.footnoteref {
320 vertical-align: super;
321}
322
323#footnotes {
324 margin: 20px 0 20px 0;
325 padding: 7px 0 0 0;
326}
327
328#footnotes div.footnote {
329 margin: 0 0 5px 0;
330}
331
332#footnotes hr {
333 border: none;
334 border-top: 1px solid silver;
335 height: 1px;
336 text-align: left;
337 margin-left: 0;
338 width: 20%;
339 min-width: 100px;
340}
341
342
Junio C Hamano1a4e8412005-12-27 08:17:23343@media print {
344 div#footer-badges { display: none; }
345}
Junio C Hamanoba4b9282008-07-06 05:20:31346
Junio C Hamano7bd050f2011-09-22 06:32:22347div#toc {
348 margin-bottom: 2.5em;
349}
350
Junio C Hamanoba4b9282008-07-06 05:20:31351div#toctitle {
352 color: #527bbd;
353 font-family: sans-serif;
354 font-size: 1.1em;
355 font-weight: bold;
356 margin-top: 1.0em;
357 margin-bottom: 0.1em;
358}
359
360div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
361 margin-top: 0;
362 margin-bottom: 0;
363}
364div.toclevel2 {
365 margin-left: 2em;
366 font-size: 0.9em;
367}
368div.toclevel3 {
369 margin-left: 4em;
370 font-size: 0.9em;
371}
372div.toclevel4 {
373 margin-left: 6em;
374 font-size: 0.9em;
375}
Junio C Hamano60186642010-12-02 14:18:26376/* Overrides for manpage documents */
377h1 {
378 padding-top: 0.5em;
379 padding-bottom: 0.5em;
380 border-top: 2px solid silver;
381 border-bottom: 2px solid silver;
382}
383h2 {
384 border-style: none;
385}
386div.sectionbody {
387 margin-left: 5%;
388}
389
390@media print {
391 div#toc { display: none; }
392}
393
Junio C Hamano1a4e8412005-12-27 08:17:23394/* Workarounds for IE6's broken and incomplete CSS2. */
395
396div.sidebar-content {
397 background: #ffffee;
398 border: 1px solid silver;
399 padding: 0.5em;
400}
401div.sidebar-title, div.image-title {
Junio C Hamano60186642010-12-02 14:18:26402 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23403 font-family: sans-serif;
404 font-weight: bold;
405 margin-top: 0.0em;
406 margin-bottom: 0.5em;
407}
408
409div.listingblock div.content {
410 border: 1px solid silver;
411 background: #f4f4f4;
412 padding: 0.5em;
413}
414
Junio C Hamano60186642010-12-02 14:18:26415div.quoteblock-attribution {
416 padding-top: 0.5em;
417 text-align: right;
418}
419
420div.verseblock-content {
421 white-space: pre;
422}
423div.verseblock-attribution {
424 padding-top: 0.75em;
425 text-align: left;
Junio C Hamano1a4e8412005-12-27 08:17:23426}
427
428div.exampleblock-content {
Junio C Hamano7bd050f2011-09-22 06:32:22429 border-left: 3px solid #dddddd;
Junio C Hamano1a4e8412005-12-27 08:17:23430 padding-left: 0.5em;
431}
Junio C Hamanoba4b9282008-07-06 05:20:31432
433/* IE6 sets dynamically generated links as visited. */
434div#toc a:visited { color: blue; }
Junio C Hamano1a4e8412005-12-27 08:17:23435</style>
Junio C Hamano7bd050f2011-09-22 06:32:22436<script type="text/javascript">
437/*<![CDATA[*/
438window.onload = function(){asciidoc.footnotes();}
439var asciidoc = { // Namespace.
440
441/////////////////////////////////////////////////////////////////////
442// Table Of Contents generator
443/////////////////////////////////////////////////////////////////////
444
445/* Author: Mihai Bazon, September 2002
446 * http://students.infoiasi.ro/~mishoo
447 *
448 * Table Of Content generator
449 * Version: 0.4
450 *
451 * Feel free to use this script under the terms of the GNU General Public
452 * License, as long as you do not remove or alter this notice.
453 */
454
455 /* modified by Troy D. Hanson, September 2006. License: GPL */
456 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
457
458// toclevels = 1..4.
459toc: function (toclevels) {
460
461 function getText(el) {
462 var text = "";
463 for (var i = el.firstChild; i != null; i = i.nextSibling) {
464 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
465 text += i.data;
466 else if (i.firstChild != null)
467 text += getText(i);
468 }
469 return text;
470 }
471
472 function TocEntry(el, text, toclevel) {
473 this.element = el;
474 this.text = text;
475 this.toclevel = toclevel;
476 }
477
478 function tocEntries(el, toclevels) {
479 var result = new Array;
480 var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
481 // Function that scans the DOM tree for header elements (the DOM2
482 // nodeIterator API would be a better technique but not supported by all
483 // browsers).
484 var iterate = function (el) {
485 for (var i = el.firstChild; i != null; i = i.nextSibling) {
486 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
487 var mo = re.exec(i.tagName);
488 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
489 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
490 }
491 iterate(i);
492 }
493 }
494 }
495 iterate(el);
496 return result;
497 }
498
499 var toc = document.getElementById("toc");
500 var entries = tocEntries(document.getElementById("content"), toclevels);
501 for (var i = 0; i < entries.length; ++i) {
502 var entry = entries[i];
503 if (entry.element.id == "")
504 entry.element.id = "_toc_" + i;
505 var a = document.createElement("a");
506 a.href = "#" + entry.element.id;
507 a.appendChild(document.createTextNode(entry.text));
508 var div = document.createElement("div");
509 div.appendChild(a);
510 div.className = "toclevel" + entry.toclevel;
511 toc.appendChild(div);
512 }
513 if (entries.length == 0)
514 toc.parentNode.removeChild(toc);
515},
516
517
518/////////////////////////////////////////////////////////////////////
519// Footnotes generator
520/////////////////////////////////////////////////////////////////////
521
522/* Based on footnote generation code from:
523 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
524 */
525
526footnotes: function () {
527 var cont = document.getElementById("content");
528 var noteholder = document.getElementById("footnotes");
529 var spans = cont.getElementsByTagName("span");
530 var refs = {};
531 var n = 0;
532 for (i=0; i<spans.length; i++) {
533 if (spans[i].className == "footnote") {
534 n++;
535 // Use [\s\S] in place of . so multi-line matches work.
536 // Because JavaScript has no s (dotall) regex flag.
537 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
538 noteholder.innerHTML +=
539 "<div class='footnote' id='_footnote_" + n + "'>" +
540 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
541 n + "</a>. " + note + "</div>";
542 spans[i].innerHTML =
543 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
544 "' title='View footnote' class='footnote'>" + n + "</a>]";
545 var id =spans[i].getAttribute("id");
546 if (id != null) refs["#"+id] = n;
547 }
548 }
549 if (n == 0)
550 noteholder.parentNode.removeChild(noteholder);
551 else {
552 // Process footnoterefs.
553 for (i=0; i<spans.length; i++) {
554 if (spans[i].className == "footnoteref") {
555 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
556 href = href.match(/#.*/)[0]; // Because IE return full URL.
557 n = refs[href];
558 spans[i].innerHTML =
559 "[<a href='#_footnote_" + n +
560 "' title='View footnote' class='footnote'>" + n + "</a>]";
561 }
562 }
563 }
564}
565
566}
567/*]]>*/
568</script>
Junio C Hamano1a4e8412005-12-27 08:17:23569</head>
570<body>
571<div id="header">
572<h1>
573git-commit(1) Manual Page
574</h1>
575<h2>NAME</h2>
576<div class="sectionbody">
577<p>git-commit -
Junio C Hamano7c73c662007-01-19 00:37:50578 Record changes to the repository
Junio C Hamano1a4e8412005-12-27 08:17:23579</p>
580</div>
581</div>
Junio C Hamano7bd050f2011-09-22 06:32:22582<div id="content">
Junio C Hamano60186642010-12-02 14:18:26583<h2 id="_synopsis">SYNOPSIS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23584<div class="sectionbody">
Junio C Hamano235a91e2006-01-07 01:13:58585<div class="verseblock">
Junio C Hamano3d050d62011-05-17 06:43:34586<div class="verseblock-content"><em>git commit</em> [-a | --interactive | --patch] [-s] [-v] [-u&lt;mode&gt;] [--amend]
587 [--dry-run] [(-c | -C | --fixup | --squash) &lt;commit&gt;]
588 [-F &lt;file&gt; | -m &lt;msg&gt;] [--reset-author] [--allow-empty]
589 [--allow-empty-message] [--no-verify] [-e] [--author=&lt;author&gt;]
590 [--date=&lt;date&gt;] [--cleanup=&lt;mode&gt;] [--status | --no-status]
591 [-i | -o] [--] [&lt;file&gt;&#8230;]</div>
Junio C Hamano60186642010-12-02 14:18:26592<div class="verseblock-attribution">
593</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23594</div>
Junio C Hamanoba4b9282008-07-06 05:20:31595<h2 id="_description">DESCRIPTION</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23596<div class="sectionbody">
Junio C Hamano60186642010-12-02 14:18:26597<div class="paragraph"><p>Stores the current contents of the index in a new commit along
Junio C Hamanoba4b9282008-07-06 05:20:31598with a log message from the user describing the changes.</p></div>
Junio C Hamano60186642010-12-02 14:18:26599<div class="paragraph"><p>The content to be added can be specified in several ways:</p></div>
600<div class="olist arabic"><ol class="arabic">
Junio C Hamanoe7935c42006-12-13 21:32:17601<li>
602<p>
Junio C Hamano1aa40d22010-01-21 17:46:43603by using <em>git add</em> to incrementally "add" changes to the
Junio C Hamanob515b6a2007-08-08 09:21:16604 index before using the <em>commit</em> command (Note: even modified
605 files must be "added");
606</p>
607</li>
608<li>
609<p>
Junio C Hamano1aa40d22010-01-21 17:46:43610by using <em>git rm</em> to remove files from the working tree
Junio C Hamanobd2b4bb2007-08-06 06:42:24611 and the index, again before using the <em>commit</em> command;
Junio C Hamanoe7935c42006-12-13 21:32:17612</p>
613</li>
614<li>
615<p>
Junio C Hamanobd2b4bb2007-08-06 06:42:24616by listing files as arguments to the <em>commit</em> command, in which
617 case the commit will ignore changes staged in the index, and instead
Junio C Hamano50819852008-11-19 02:07:56618 record the current content of the listed files (which must already
619 be known to git);
Junio C Hamanoe7935c42006-12-13 21:32:17620</p>
621</li>
622<li>
623<p>
Junio C Hamanobd2b4bb2007-08-06 06:42:24624by using the -a switch with the <em>commit</em> command to automatically
625 "add" changes from all known files (i.e. all files that are already
626 listed in the index) and to automatically "rm" files in the index
627 that have been removed from the working tree, and then perform the
628 actual commit;
Junio C Hamanoe7935c42006-12-13 21:32:17629</p>
630</li>
Junio C Hamanoc51fede2007-03-12 07:29:20631<li>
632<p>
Junio C Hamano3d050d62011-05-17 06:43:34633by using the --interactive or --patch switches with the <em>commit</em> command
634 to decide one by one which files or hunks should be part of the commit,
Junio C Hamanob76a6862012-05-02 22:02:46635 before finalizing the operation. See the &#8220;Interactive Mode&#8221; section of
Junio C Hamano3d050d62011-05-17 06:43:34636 <a href="git-add.html">git-add(1)</a> to learn how to operate these modes.
Junio C Hamanoc51fede2007-03-12 07:29:20637</p>
638</li>
Junio C Hamanoba4b9282008-07-06 05:20:31639</ol></div>
Junio C Hamano60186642010-12-02 14:18:26640<div class="paragraph"><p>The <tt>--dry-run</tt> option can be used to obtain a
Junio C Hamanoe7935c42006-12-13 21:32:17641summary of what is included by any of the above for the next
Junio C Hamano1bb31992009-08-29 04:24:08642commit by giving the same set of parameters (options and paths).</p></div>
Junio C Hamano60186642010-12-02 14:18:26643<div class="paragraph"><p>If you make a commit and then find a mistake immediately after
Junio C Hamano1aa40d22010-01-21 17:46:43644that, you can recover from it with <em>git reset</em>.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23645</div>
Junio C Hamanoba4b9282008-07-06 05:20:31646<h2 id="_options">OPTIONS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23647<div class="sectionbody">
Junio C Hamano60186642010-12-02 14:18:26648<div class="dlist"><dl>
649<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47650-a
651</dt>
Junio C Hamano60186642010-12-02 14:18:26652<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47653--all
Junio C Hamano1a4e8412005-12-27 08:17:23654</dt>
655<dd>
656<p>
Junio C Hamanoe7935c42006-12-13 21:32:17657 Tell the command to automatically stage files that have
658 been modified and deleted, but new files you have not
659 told git about are not affected.
Junio C Hamano1a4e8412005-12-27 08:17:23660</p>
661</dd>
Junio C Hamano60186642010-12-02 14:18:26662<dt class="hdlist1">
Junio C Hamano3d050d62011-05-17 06:43:34663-p
664</dt>
665<dt class="hdlist1">
666--patch
667</dt>
668<dd>
669<p>
670 Use the interactive patch selection interface to chose
671 which changes to commit. See <a href="git-add.html">git-add(1)</a> for
672 details.
673</p>
674</dd>
675<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47676-C &lt;commit&gt;
677</dt>
Junio C Hamano60186642010-12-02 14:18:26678<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47679--reuse-message=&lt;commit&gt;
Junio C Hamano1a4e8412005-12-27 08:17:23680</dt>
681<dd>
682<p>
Junio C Hamanoeb415992008-06-08 22:49:47683 Take an existing commit object, and reuse the log message
Junio C Hamano1a4e8412005-12-27 08:17:23684 and the authorship information (including the timestamp)
Junio C Hamanoeb415992008-06-08 22:49:47685 when creating the commit.
686</p>
687</dd>
Junio C Hamano60186642010-12-02 14:18:26688<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47689-c &lt;commit&gt;
690</dt>
Junio C Hamano60186642010-12-02 14:18:26691<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47692--reedit-message=&lt;commit&gt;
693</dt>
694<dd>
695<p>
696 Like <em>-C</em>, but with <em>-c</em> the editor is invoked, so that
697 the user can further edit the commit message.
Junio C Hamano1a4e8412005-12-27 08:17:23698</p>
699</dd>
Junio C Hamano60186642010-12-02 14:18:26700<dt class="hdlist1">
Junio C Hamano2e6ded82010-12-05 06:20:48701--fixup=&lt;commit&gt;
702</dt>
703<dd>
704<p>
705 Construct a commit message for use with <tt>rebase --autosquash</tt>.
706 The commit message will be the subject line from the specified
707 commit with a prefix of "fixup! ". See <a href="git-rebase.html">git-rebase(1)</a>
708 for details.
709</p>
710</dd>
711<dt class="hdlist1">
712--squash=&lt;commit&gt;
713</dt>
714<dd>
715<p>
716 Construct a commit message for use with <tt>rebase --autosquash</tt>.
717 The commit message subject line is taken from the specified
718 commit with a prefix of "squash! ". Can be used with additional
719 commit message options (<tt>-m</tt>/<tt>-c</tt>/<tt>-C</tt>/<tt>-F</tt>). See
720 <a href="git-rebase.html">git-rebase(1)</a> for details.
721</p>
722</dd>
723<dt class="hdlist1">
Junio C Hamano2bd8a742009-12-01 21:16:59724--reset-author
725</dt>
726<dd>
727<p>
Junio C Hamanoa8cc1d82011-03-10 01:18:12728 When used with -C/-c/--amend options, or when committing after a
729 a conflicting cherry-pick, declare that the authorship of the
730 resulting commit now belongs of the committer. This also renews
731 the author timestamp.
Junio C Hamano2bd8a742009-12-01 21:16:59732</p>
733</dd>
Junio C Hamano60186642010-12-02 14:18:26734<dt class="hdlist1">
Junio C Hamanoa0fae262009-12-28 09:33:50735--short
736</dt>
737<dd>
738<p>
739 When doing a dry-run, give the output in the short-format. See
740 <a href="git-status.html">git-status(1)</a> for details. Implies <tt>--dry-run</tt>.
741</p>
742</dd>
Junio C Hamano60186642010-12-02 14:18:26743<dt class="hdlist1">
Junio C Hamanoa0fae262009-12-28 09:33:50744--porcelain
745</dt>
746<dd>
747<p>
748 When doing a dry-run, give the output in a porcelain-ready
749 format. See <a href="git-status.html">git-status(1)</a> for details. Implies
750 <tt>--dry-run</tt>.
751</p>
752</dd>
Junio C Hamano60186642010-12-02 14:18:26753<dt class="hdlist1">
Junio C Hamanoa0fae262009-12-28 09:33:50754-z
755</dt>
756<dd>
757<p>
758 When showing <tt>short</tt> or <tt>porcelain</tt> status output, terminate
759 entries in the status output with NUL, instead of LF. If no
760 format is given, implies the <tt>--porcelain</tt> output format.
761</p>
762</dd>
Junio C Hamano60186642010-12-02 14:18:26763<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23764-F &lt;file&gt;
765</dt>
Junio C Hamano60186642010-12-02 14:18:26766<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47767--file=&lt;file&gt;
768</dt>
Junio C Hamano1a4e8412005-12-27 08:17:23769<dd>
770<p>
771 Take the commit message from the given file. Use <em>-</em> to
772 read the message from the standard input.
773</p>
774</dd>
Junio C Hamano60186642010-12-02 14:18:26775<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47776--author=&lt;author&gt;
Junio C Hamano40f2f8d2006-02-07 08:04:39777</dt>
778<dd>
779<p>
Junio C Hamano13002fb2010-06-08 05:53:58780 Override the commit author. Specify an explicit author using the
Junio C Hamanob76a6862012-05-02 22:02:46781 standard <tt>A U Thor &lt;author@example.com&gt;</tt> format. Otherwise &lt;author&gt;
Junio C Hamano13002fb2010-06-08 05:53:58782 is assumed to be a pattern and is used to search for an existing
783 commit by that author (i.e. rev-list --all -i --author=&lt;author&gt;);
784 the commit author is then copied from the first such commit found.
Junio C Hamano40f2f8d2006-02-07 08:04:39785</p>
786</dd>
Junio C Hamano60186642010-12-02 14:18:26787<dt class="hdlist1">
Junio C Hamanoae05fee2010-01-08 07:39:46788--date=&lt;date&gt;
789</dt>
790<dd>
791<p>
792 Override the author date used in the commit.
793</p>
794</dd>
Junio C Hamano60186642010-12-02 14:18:26795<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47796-m &lt;msg&gt;
797</dt>
Junio C Hamano60186642010-12-02 14:18:26798<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47799--message=&lt;msg&gt;
Junio C Hamano1a4e8412005-12-27 08:17:23800</dt>
801<dd>
802<p>
803 Use the given &lt;msg&gt; as the commit message.
804</p>
805</dd>
Junio C Hamano60186642010-12-02 14:18:26806<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47807-t &lt;file&gt;
808</dt>
Junio C Hamano60186642010-12-02 14:18:26809<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47810--template=&lt;file&gt;
Junio C Hamanoa3770f92007-07-25 08:53:33811</dt>
812<dd>
813<p>
Junio C Hamano51f87de2012-04-16 21:18:54814 When editing the commit message, start the editor with the
815 contents in the given file. The <tt>commit.template</tt> configuration
816 variable is often used to give this option implicitly to the
817 command. This mechanism can be used by projects that want to
818 guide participants with some hints on what to write in the message
819 in what order. If the user exits the editor without editing the
820 message, the commit is aborted. This has no effect when a message
821 is given by other means, e.g. with the <tt>-m</tt> or <tt>-F</tt> options.
Junio C Hamanoa3770f92007-07-25 08:53:33822</p>
823</dd>
Junio C Hamano60186642010-12-02 14:18:26824<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47825-s
826</dt>
Junio C Hamano60186642010-12-02 14:18:26827<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47828--signoff
Junio C Hamano1a4e8412005-12-27 08:17:23829</dt>
830<dd>
831<p>
Junio C Hamano610d1762008-11-28 06:27:13832 Add Signed-off-by line by the committer at the end of the commit
Junio C Hamano7d06a8a2008-10-20 05:42:33833 log message.
Junio C Hamano1a4e8412005-12-27 08:17:23834</p>
835</dd>
Junio C Hamano60186642010-12-02 14:18:26836<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47837-n
838</dt>
Junio C Hamano60186642010-12-02 14:18:26839<dt class="hdlist1">
Junio C Hamanoe7935c42006-12-13 21:32:17840--no-verify
Junio C Hamano1a4e8412005-12-27 08:17:23841</dt>
842<dd>
843<p>
Junio C Hamano942b35e2007-12-09 10:19:33844 This option bypasses the pre-commit and commit-msg hooks.
Junio C Hamanofce7c7e2008-07-02 03:06:38845 See also <a href="githooks.html">githooks(5)</a>.
Junio C Hamano1a4e8412005-12-27 08:17:23846</p>
847</dd>
Junio C Hamano60186642010-12-02 14:18:26848<dt class="hdlist1">
Junio C Hamano0c999702007-12-03 09:57:55849--allow-empty
850</dt>
851<dd>
852<p>
853 Usually recording a commit that has the exact same tree as its
Junio C Hamano58256872007-12-04 08:31:13854 sole parent commit is a mistake, and the command prevents you
855 from making such a commit. This option bypasses the safety, and
Junio C Hamano619596a2010-08-18 22:15:35856 is primarily for use by foreign SCM interface scripts.
Junio C Hamano0c999702007-12-03 09:57:55857</p>
858</dd>
Junio C Hamano60186642010-12-02 14:18:26859<dt class="hdlist1">
Junio C Hamanocb39aea2010-05-09 07:24:48860--allow-empty-message
861</dt>
862<dd>
863<p>
864 Like --allow-empty this command is primarily for use by foreign
Junio C Hamano619596a2010-08-18 22:15:35865 SCM interface scripts. It allows you to create a commit with an
Junio C Hamanocb39aea2010-05-09 07:24:48866 empty commit message without using plumbing commands like
867 <a href="git-commit-tree.html">git-commit-tree(1)</a>.
868</p>
869</dd>
Junio C Hamano60186642010-12-02 14:18:26870<dt class="hdlist1">
Junio C Hamano554da792007-12-27 03:29:58871--cleanup=&lt;mode&gt;
872</dt>
873<dd>
874<p>
875 This option sets how the commit message is cleaned up.
876 The <em>&lt;mode&gt;</em> can be one of <em>verbatim</em>, <em>whitespace</em>, <em>strip</em>,
877 and <em>default</em>. The <em>default</em> mode will strip leading and
878 trailing empty lines and #commentary from the commit message
879 only if the message is to be edited. Otherwise only whitespace
880 removed. The <em>verbatim</em> mode does not change message at all,
881 <em>whitespace</em> removes just leading/trailing whitespace lines
882 and <em>strip</em> removes both whitespace and commentary.
883</p>
884</dd>
Junio C Hamano60186642010-12-02 14:18:26885<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47886-e
887</dt>
Junio C Hamano60186642010-12-02 14:18:26888<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47889--edit
Junio C Hamano1a4e8412005-12-27 08:17:23890</dt>
891<dd>
892<p>
893 The message taken from file with <tt>-F</tt>, command line with
894 <tt>-m</tt>, and from file with <tt>-C</tt> are usually used as the
895 commit log message unmodified. This option lets you
896 further edit the message taken from these sources.
897</p>
898</dd>
Junio C Hamano60186642010-12-02 14:18:26899<dt class="hdlist1">
Junio C Hamanobfe9e752006-04-05 21:43:28900--amend
901</dt>
902<dd>
903<p>
904 Used to amend the tip of the current branch. Prepare the tree
905 object you would want to replace the latest commit as usual
906 (this includes the usual -i/-o and explicit paths), and the
907 commit log editor is seeded with the commit message from the
908 tip of the current branch. The commit you create replaces the
Junio C Hamano60186642010-12-02 14:18:26909 current tip&#8201;&#8212;&#8201;if it was a merge, it will have the parents of
910 the current tip as parents&#8201;&#8212;&#8201;so the current top commit is
Junio C Hamanobfe9e752006-04-05 21:43:28911 discarded.
912</p>
Junio C Hamano60186642010-12-02 14:18:26913<div class="paragraph"><p>It is a rough equivalent for:</p></div>
Junio C Hamanobfe9e752006-04-05 21:43:28914<div class="listingblock">
915<div class="content">
916<pre><tt> $ git reset --soft HEAD^
917 $ ... do something else to come up with the right tree ...
Junio C Hamano60186642010-12-02 14:18:26918 $ git commit -c ORIG_HEAD</tt></pre>
Junio C Hamanobfe9e752006-04-05 21:43:28919</div></div>
Junio C Hamano60186642010-12-02 14:18:26920<div class="paragraph"><p>but can be used to amend a merge commit.</p></div>
921<div class="paragraph"><p>You should understand the implications of rewriting history if you
Junio C Hamano7d06a8a2008-10-20 05:42:33922amend a commit that has already been published. (See the "RECOVERING
923FROM UPSTREAM REBASE" section in <a href="git-rebase.html">git-rebase(1)</a>.)</p></div>
Junio C Hamanobfe9e752006-04-05 21:43:28924</dd>
Junio C Hamano60186642010-12-02 14:18:26925<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47926-i
927</dt>
Junio C Hamano60186642010-12-02 14:18:26928<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47929--include
Junio C Hamano40f2f8d2006-02-07 08:04:39930</dt>
931<dd>
932<p>
Junio C Hamanoe7935c42006-12-13 21:32:17933 Before making a commit out of staged contents so far,
934 stage the contents of paths given on the command line
935 as well. This is usually not what you want unless you
936 are concluding a conflicted merge.
Junio C Hamano6697ac52006-02-14 08:00:23937</p>
938</dd>
Junio C Hamano60186642010-12-02 14:18:26939<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47940-o
941</dt>
Junio C Hamano60186642010-12-02 14:18:26942<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47943--only
Junio C Hamanoe79159d2008-04-12 08:23:17944</dt>
945<dd>
946<p>
947 Make a commit only from the paths specified on the
948 command line, disregarding any contents that have been
949 staged so far. This is the default mode of operation of
Junio C Hamano1aa40d22010-01-21 17:46:43950 <em>git commit</em> if any paths are given on the command line,
Junio C Hamanoe79159d2008-04-12 08:23:17951 in which case this option can be omitted.
952 If this option is specified together with <em>--amend</em>, then
Junio C Hamano54bf1e22008-12-20 06:30:11953 no paths need to be specified, which can be used to amend
Junio C Hamanoe79159d2008-04-12 08:23:17954 the last commit without committing changes that have
955 already been staged.
956</p>
957</dd>
Junio C Hamano60186642010-12-02 14:18:26958<dt class="hdlist1">
Junio C Hamano4224f992008-06-23 07:14:08959-u[&lt;mode&gt;]
Junio C Hamanoeb415992008-06-08 22:49:47960</dt>
Junio C Hamano60186642010-12-02 14:18:26961<dt class="hdlist1">
Junio C Hamano4224f992008-06-23 07:14:08962--untracked-files[=&lt;mode&gt;]
Junio C Hamano1e6e0062007-07-13 05:33:25963</dt>
964<dd>
965<p>
Junio C Hamano36a4dbc2011-02-22 07:51:32966 Show untracked files.
Junio C Hamano1e6e0062007-07-13 05:33:25967</p>
Junio C Hamano36a4dbc2011-02-22 07:51:32968<div class="paragraph"><p>The mode parameter is optional (defaults to <em>all</em>), and is used to
969specify the handling of untracked files; when -u is not used, the
970default is <em>normal</em>, i.e. show untracked files and directories.</p></div>
Junio C Hamano60186642010-12-02 14:18:26971<div class="paragraph"><p>The possible options are:</p></div>
972<div class="ulist"><ul>
Junio C Hamano4224f992008-06-23 07:14:08973<li>
974<p>
975<em>no</em> - Show no untracked files
976</p>
977</li>
978<li>
979<p>
980<em>normal</em> - Shows untracked files and directories
981</p>
982</li>
983<li>
984<p>
985<em>all</em> - Also shows individual files in untracked directories.
986</p>
Junio C Hamano36a4dbc2011-02-22 07:51:32987<div class="paragraph"><p>The default can be changed using the status.showUntrackedFiles
988configuration variable documented in <a href="git-config.html">git-config(1)</a>.</p></div>
Junio C Hamanoe1cca182010-02-20 20:01:23989</li>
990</ul></div>
Junio C Hamano1e6e0062007-07-13 05:33:25991</dd>
Junio C Hamano60186642010-12-02 14:18:26992<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47993-v
994</dt>
Junio C Hamano60186642010-12-02 14:18:26995<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47996--verbose
Junio C Hamano1e6e0062007-07-13 05:33:25997</dt>
998<dd>
999<p>
1000 Show unified diff between the HEAD commit and what
1001 would be committed at the bottom of the commit message
Junio C Hamano60186642010-12-02 14:18:261002 template. Note that this diff output doesn&#8217;t have its
Junio C Hamano1e6e0062007-07-13 05:33:251003 lines prefixed with <em>#</em>.
1004</p>
1005</dd>
Junio C Hamano60186642010-12-02 14:18:261006<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471007-q
1008</dt>
Junio C Hamano60186642010-12-02 14:18:261009<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471010--quiet
Junio C Hamano7d23f5e2006-12-16 07:44:041011</dt>
1012<dd>
1013<p>
Junio C Hamanof9771f62007-01-17 17:42:301014 Suppress commit summary message.
Junio C Hamano7d23f5e2006-12-16 07:44:041015</p>
1016</dd>
Junio C Hamano60186642010-12-02 14:18:261017<dt class="hdlist1">
Junio C Hamano1bb31992009-08-29 04:24:081018--dry-run
1019</dt>
1020<dd>
1021<p>
1022 Do not create a commit, but show a list of paths that are
1023 to be committed, paths with local changes that will be left
1024 uncommitted and paths that are untracked.
1025</p>
1026</dd>
Junio C Hamano60186642010-12-02 14:18:261027<dt class="hdlist1">
Junio C Hamano6ce6b6c2010-01-18 01:25:501028--status
1029</dt>
1030<dd>
1031<p>
1032 Include the output of <a href="git-status.html">git-status(1)</a> in the commit
1033 message template when using an editor to prepare the commit
1034 message. Defaults to on, but can be used to override
1035 configuration variable commit.status.
1036</p>
1037</dd>
Junio C Hamano60186642010-12-02 14:18:261038<dt class="hdlist1">
Junio C Hamano6ce6b6c2010-01-18 01:25:501039--no-status
1040</dt>
1041<dd>
1042<p>
1043 Do not include the output of <a href="git-status.html">git-status(1)</a> in the
1044 commit message template when using an editor to prepare the
1045 default commit message.
1046</p>
1047</dd>
Junio C Hamano60186642010-12-02 14:18:261048<dt class="hdlist1">
Junio C Hamano1bb569e2006-05-05 23:14:251049--
Junio C Hamano1a4e8412005-12-27 08:17:231050</dt>
1051<dd>
1052<p>
1053 Do not interpret any more arguments as options.
1054</p>
1055</dd>
Junio C Hamano60186642010-12-02 14:18:261056<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231057&lt;file&gt;&#8230;
1058</dt>
1059<dd>
1060<p>
Junio C Hamanoe7935c42006-12-13 21:32:171061 When files are given on the command line, the command
1062 commits the contents of the named files, without
1063 recording the changes already staged. The contents of
1064 these files are also staged for the next commit on top
1065 of what have been staged before.
Junio C Hamano1a4e8412005-12-27 08:17:231066</p>
1067</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311068</dl></div>
Junio C Hamano1a4e8412005-12-27 08:17:231069</div>
Junio C Hamanoae05fee2010-01-08 07:39:461070<h2 id="_date_formats">DATE FORMATS</h2>
1071<div class="sectionbody">
Junio C Hamano60186642010-12-02 14:18:261072<div class="paragraph"><p>The GIT_AUTHOR_DATE, GIT_COMMITTER_DATE environment variables
Junio C Hamanoae05fee2010-01-08 07:39:461073and the <tt>--date</tt> option
1074support the following date formats:</p></div>
Junio C Hamano60186642010-12-02 14:18:261075<div class="dlist"><dl>
1076<dt class="hdlist1">
Junio C Hamanoae05fee2010-01-08 07:39:461077Git internal format
1078</dt>
1079<dd>
1080<p>
1081 It is <tt>&lt;unix timestamp&gt; &lt;timezone offset&gt;</tt>, where <tt>&lt;unix
1082 timestamp&gt;</tt> is the number of seconds since the UNIX epoch.
1083 <tt>&lt;timezone offset&gt;</tt> is a positive or negative offset from UTC.
1084 For example CET (which is 2 hours ahead UTC) is <tt>+0200</tt>.
1085</p>
1086</dd>
Junio C Hamano60186642010-12-02 14:18:261087<dt class="hdlist1">
Junio C Hamanoae05fee2010-01-08 07:39:461088RFC 2822
1089</dt>
1090<dd>
1091<p>
1092 The standard email format as described by RFC 2822, for example
1093 <tt>Thu, 07 Apr 2005 22:13:13 +0200</tt>.
1094</p>
1095</dd>
Junio C Hamano60186642010-12-02 14:18:261096<dt class="hdlist1">
Junio C Hamanoae05fee2010-01-08 07:39:461097ISO 8601
1098</dt>
1099<dd>
1100<p>
1101 Time and date specified by the ISO 8601 standard, for example
1102 <tt>2005-04-07T22:13:13</tt>. The parser accepts a space instead of the
1103 <tt>T</tt> character as well.
1104</p>
1105<div class="admonitionblock">
1106<table><tr>
1107<td class="icon">
1108<div class="title">Note</div>
1109</td>
1110<td class="content">In addition, the date part is accepted in the following formats:
1111<tt>YYYY.MM.DD</tt>, <tt>MM/DD/YYYY</tt> and <tt>DD.MM.YYYY</tt>.</td>
1112</tr></table>
1113</div>
1114</dd>
1115</dl></div>
1116</div>
Junio C Hamanoba4b9282008-07-06 05:20:311117<h2 id="_examples">EXAMPLES</h2>
Junio C Hamano40f2f8d2006-02-07 08:04:391118<div class="sectionbody">
Junio C Hamano60186642010-12-02 14:18:261119<div class="paragraph"><p>When recording your own work, the contents of modified files in
Junio C Hamanoe7935c42006-12-13 21:32:171120your working tree are temporarily stored to a staging area
Junio C Hamano1aa40d22010-01-21 17:46:431121called the "index" with <em>git add</em>. A file can be
Junio C Hamano361c1332007-11-14 12:17:221122reverted back, only in the index but not in the working tree,
Junio C Hamano360e3a12011-07-13 23:51:561123to that of the last commit with <tt>git reset HEAD -- &lt;file&gt;</tt>,
Junio C Hamano1aa40d22010-01-21 17:46:431124which effectively reverts <em>git add</em> and prevents the changes to
Junio C Hamano361c1332007-11-14 12:17:221125this file from participating in the next commit. After building
1126the state to be committed incrementally with these commands,
1127<tt>git commit</tt> (without any pathname parameter) is used to record what
Junio C Hamanoe7935c42006-12-13 21:32:171128has been staged so far. This is the most basic form of the
Junio C Hamanoba4b9282008-07-06 05:20:311129command. An example:</p></div>
Junio C Hamanoe7935c42006-12-13 21:32:171130<div class="listingblock">
Junio C Hamano40f2f8d2006-02-07 08:04:391131<div class="content">
Junio C Hamanoe7935c42006-12-13 21:32:171132<pre><tt>$ edit hello.c
1133$ git rm goodbye.c
1134$ git add hello.c
1135$ git commit</tt></pre>
Junio C Hamano40f2f8d2006-02-07 08:04:391136</div></div>
Junio C Hamano60186642010-12-02 14:18:261137<div class="paragraph"><p>Instead of staging files after each individual change, you can
Junio C Hamanoe7935c42006-12-13 21:32:171138tell <tt>git commit</tt> to notice the changes to the files whose
1139contents are tracked in
1140your working tree and do corresponding <tt>git add</tt> and <tt>git rm</tt>
1141for you. That is, this example does the same as the earlier
Junio C Hamanoba4b9282008-07-06 05:20:311142example if there is no other change in your working tree:</p></div>
Junio C Hamanoe7935c42006-12-13 21:32:171143<div class="listingblock">
1144<div class="content">
1145<pre><tt>$ edit hello.c
1146$ rm goodbye.c
1147$ git commit -a</tt></pre>
1148</div></div>
Junio C Hamano60186642010-12-02 14:18:261149<div class="paragraph"><p>The command <tt>git commit -a</tt> first looks at your working tree,
Junio C Hamanoe7935c42006-12-13 21:32:171150notices that you have modified hello.c and removed goodbye.c,
Junio C Hamanoba4b9282008-07-06 05:20:311151and performs necessary <tt>git add</tt> and <tt>git rm</tt> for you.</p></div>
Junio C Hamano60186642010-12-02 14:18:261152<div class="paragraph"><p>After staging changes to many files, you can alter the order the
Junio C Hamanoe7935c42006-12-13 21:32:171153changes are recorded in, by giving pathnames to <tt>git commit</tt>.
1154When pathnames are given, the command makes a commit that
Junio C Hamanoba4b9282008-07-06 05:20:311155only records the changes made to the named paths:</p></div>
Junio C Hamanoe7935c42006-12-13 21:32:171156<div class="listingblock">
1157<div class="content">
1158<pre><tt>$ edit hello.c hello.h
1159$ git add hello.c hello.h
1160$ edit Makefile
1161$ git commit Makefile</tt></pre>
1162</div></div>
Junio C Hamano60186642010-12-02 14:18:261163<div class="paragraph"><p>This makes a commit that records the modification to <tt>Makefile</tt>.
Junio C Hamanoe7935c42006-12-13 21:32:171164The changes staged for <tt>hello.c</tt> and <tt>hello.h</tt> are not included
Junio C Hamano60186642010-12-02 14:18:261165in the resulting commit. However, their changes are not lost&#8201;&#8212;&#8201;they are still staged and merely held back. After the above
Junio C Hamanoba4b9282008-07-06 05:20:311166sequence, if you do:</p></div>
Junio C Hamanoe7935c42006-12-13 21:32:171167<div class="listingblock">
1168<div class="content">
1169<pre><tt>$ git commit</tt></pre>
1170</div></div>
Junio C Hamano60186642010-12-02 14:18:261171<div class="paragraph"><p>this second commit would record the changes to <tt>hello.c</tt> and
Junio C Hamanoba4b9282008-07-06 05:20:311172<tt>hello.h</tt> as expected.</p></div>
Junio C Hamano60186642010-12-02 14:18:261173<div class="paragraph"><p>After a merge (initiated by <em>git merge</em> or <em>git pull</em>) stops
Junio C Hamanofce7c7e2008-07-02 03:06:381174because of conflicts, cleanly merged
Junio C Hamanoe7935c42006-12-13 21:32:171175paths are already staged to be committed for you, and paths that
1176conflicted are left in unmerged state. You would have to first
Junio C Hamano1aa40d22010-01-21 17:46:431177check which paths are conflicting with <em>git status</em>
Junio C Hamanoe7935c42006-12-13 21:32:171178and after fixing them manually in your working tree, you would
Junio C Hamano1aa40d22010-01-21 17:46:431179stage the result as usual with <em>git add</em>:</p></div>
Junio C Hamanoe7935c42006-12-13 21:32:171180<div class="listingblock">
1181<div class="content">
1182<pre><tt>$ git status | grep unmerged
1183unmerged: hello.c
1184$ edit hello.c
1185$ git add hello.c</tt></pre>
1186</div></div>
Junio C Hamano60186642010-12-02 14:18:261187<div class="paragraph"><p>After resolving conflicts and staging the result, <tt>git ls-files -u</tt>
Junio C Hamanoe7935c42006-12-13 21:32:171188would stop mentioning the conflicted path. When you are done,
Junio C Hamanoba4b9282008-07-06 05:20:311189run <tt>git commit</tt> to finally record the merge:</p></div>
Junio C Hamanoe7935c42006-12-13 21:32:171190<div class="listingblock">
1191<div class="content">
1192<pre><tt>$ git commit</tt></pre>
1193</div></div>
Junio C Hamano60186642010-12-02 14:18:261194<div class="paragraph"><p>As with the case to record your own changes, you can use <tt>-a</tt>
Junio C Hamanoe7935c42006-12-13 21:32:171195option to save typing. One difference is that during a merge
1196resolution, you cannot use <tt>git commit</tt> with pathnames to
1197alter the order the changes are committed, because the merge
1198should be recorded as a single commit. In fact, the command
Junio C Hamanoba4b9282008-07-06 05:20:311199refuses to run when given pathnames (but see <tt>-i</tt> option).</p></div>
Junio C Hamanoe7935c42006-12-13 21:32:171200</div>
Junio C Hamanoba4b9282008-07-06 05:20:311201<h2 id="_discussion">DISCUSSION</h2>
Junio C Hamano775a0f42006-12-31 01:19:141202<div class="sectionbody">
Junio C Hamano60186642010-12-02 14:18:261203<div class="paragraph"><p>Though not required, it&#8217;s a good idea to begin the commit message
Junio C Hamano8f76dc62007-01-17 07:24:251204with a single short (less than 50 character) line summarizing the
1205change, followed by a blank line and then a more thorough description.
1206Tools that turn commits into email, for example, use the first line
Junio C Hamanoba4b9282008-07-06 05:20:311207on the Subject: line and the rest of the commit in the body.</p></div>
Junio C Hamano60186642010-12-02 14:18:261208<div class="paragraph"><p>At the core level, git is character encoding agnostic.</p></div>
1209<div class="ulist"><ul>
Junio C Hamano775a0f42006-12-31 01:19:141210<li>
1211<p>
1212The pathnames recorded in the index and in the tree objects
1213 are treated as uninterpreted sequences of non-NUL bytes.
1214 What readdir(2) returns are what are recorded and compared
1215 with the data git keeps track of, which in turn are expected
1216 to be what lstat(2) and creat(2) accepts. There is no such
1217 thing as pathname encoding translation.
1218</p>
1219</li>
1220<li>
1221<p>
Junio C Hamano54bf1e22008-12-20 06:30:111222The contents of the blob objects are uninterpreted sequences
Junio C Hamano775a0f42006-12-31 01:19:141223 of bytes. There is no encoding translation at the core
1224 level.
1225</p>
1226</li>
1227<li>
1228<p>
Junio C Hamano54bf1e22008-12-20 06:30:111229The commit log messages are uninterpreted sequences of non-NUL
Junio C Hamano775a0f42006-12-31 01:19:141230 bytes.
1231</p>
1232</li>
Junio C Hamanoba4b9282008-07-06 05:20:311233</ul></div>
Junio C Hamano60186642010-12-02 14:18:261234<div class="paragraph"><p>Although we encourage that the commit log messages are encoded
Junio C Hamano775a0f42006-12-31 01:19:141235in UTF-8, both the core and git Porcelain are designed not to
1236force UTF-8 on projects. If all participants of a particular
1237project find it more convenient to use legacy encodings, git
1238does not forbid it. However, there are a few things to keep in
Junio C Hamanoba4b9282008-07-06 05:20:311239mind.</p></div>
Junio C Hamano60186642010-12-02 14:18:261240<div class="olist arabic"><ol class="arabic">
Junio C Hamano775a0f42006-12-31 01:19:141241<li>
1242<p>
Junio C Hamano1aa40d22010-01-21 17:46:431243<em>git commit</em> and <em>git commit-tree</em> issues
Junio C Hamano14b76482008-01-05 10:32:261244 a warning if the commit log message given to it does not look
Junio C Hamano775a0f42006-12-31 01:19:141245 like a valid UTF-8 string, unless you explicitly say your
1246 project uses a legacy encoding. The way to say this is to
Junio C Hamano35bb3f62007-02-19 05:35:531247 have i18n.commitencoding in <tt>.git/config</tt> file, like this:
Junio C Hamano775a0f42006-12-31 01:19:141248</p>
1249<div class="listingblock">
1250<div class="content">
Junio C Hamano35bb3f62007-02-19 05:35:531251<pre><tt>[i18n]
Junio C Hamano775a0f42006-12-31 01:19:141252 commitencoding = ISO-8859-1</tt></pre>
1253</div></div>
Junio C Hamano60186642010-12-02 14:18:261254<div class="paragraph"><p>Commit objects created with the above setting record the value
Junio C Hamano35bb3f62007-02-19 05:35:531255of <tt>i18n.commitencoding</tt> in its <tt>encoding</tt> header. This is to
Junio C Hamano775a0f42006-12-31 01:19:141256help other people who look at them later. Lack of this header
Junio C Hamanoba4b9282008-07-06 05:20:311257implies that the commit log message is encoded in UTF-8.</p></div>
Junio C Hamano775a0f42006-12-31 01:19:141258</li>
1259<li>
1260<p>
Junio C Hamano1aa40d22010-01-21 17:46:431261<em>git log</em>, <em>git show</em>, <em>git blame</em> and friends look at the
Junio C Hamanoaa17c7c2008-11-03 04:36:581262 <tt>encoding</tt> header of a commit object, and try to re-code the
1263 log message into UTF-8 unless otherwise specified. You can
Junio C Hamano775a0f42006-12-31 01:19:141264 specify the desired output encoding with
Junio C Hamano35bb3f62007-02-19 05:35:531265 <tt>i18n.logoutputencoding</tt> in <tt>.git/config</tt> file, like this:
Junio C Hamano775a0f42006-12-31 01:19:141266</p>
1267<div class="listingblock">
1268<div class="content">
Junio C Hamano35bb3f62007-02-19 05:35:531269<pre><tt>[i18n]
Junio C Hamano775a0f42006-12-31 01:19:141270 logoutputencoding = ISO-8859-1</tt></pre>
1271</div></div>
Junio C Hamano60186642010-12-02 14:18:261272<div class="paragraph"><p>If you do not have this configuration variable, the value of
Junio C Hamanoba4b9282008-07-06 05:20:311273<tt>i18n.commitencoding</tt> is used instead.</p></div>
Junio C Hamano775a0f42006-12-31 01:19:141274</li>
Junio C Hamanoba4b9282008-07-06 05:20:311275</ol></div>
Junio C Hamano60186642010-12-02 14:18:261276<div class="paragraph"><p>Note that we deliberately chose not to re-code the commit log
Junio C Hamano775a0f42006-12-31 01:19:141277message when a commit is made to force UTF-8 at the commit
1278object level, because re-coding to UTF-8 is not necessarily a
Junio C Hamanoba4b9282008-07-06 05:20:311279reversible operation.</p></div>
Junio C Hamano775a0f42006-12-31 01:19:141280</div>
Junio C Hamanoba4b9282008-07-06 05:20:311281<h2 id="_environment_and_configuration_variables">ENVIRONMENT AND CONFIGURATION VARIABLES</h2>
Junio C Hamanoe7935c42006-12-13 21:32:171282<div class="sectionbody">
Junio C Hamano60186642010-12-02 14:18:261283<div class="paragraph"><p>The editor used to edit the commit log message will be chosen from the
Junio C Hamanof6002a92007-07-20 10:28:221284GIT_EDITOR environment variable, the core.editor configuration variable, the
1285VISUAL environment variable, or the EDITOR environment variable (in that
Junio C Hamano3b70d3c2009-11-21 17:37:371286order). See <a href="git-var.html">git-var(1)</a> for details.</p></div>
Junio C Hamanoe7935c42006-12-13 21:32:171287</div>
Junio C Hamanoba4b9282008-07-06 05:20:311288<h2 id="_hooks">HOOKS</h2>
Junio C Hamanoe7935c42006-12-13 21:32:171289<div class="sectionbody">
Junio C Hamano60186642010-12-02 14:18:261290<div class="paragraph"><p>This command can run <tt>commit-msg</tt>, <tt>prepare-commit-msg</tt>, <tt>pre-commit</tt>,
Junio C Hamanofce7c7e2008-07-02 03:06:381291and <tt>post-commit</tt> hooks. See <a href="githooks.html">githooks(5)</a> for more
Junio C Hamanoba4b9282008-07-06 05:20:311292information.</p></div>
Junio C Hamanoe7935c42006-12-13 21:32:171293</div>
Junio C Hamanoba4b9282008-07-06 05:20:311294<h2 id="_see_also">SEE ALSO</h2>
Junio C Hamanoe7935c42006-12-13 21:32:171295<div class="sectionbody">
Junio C Hamano60186642010-12-02 14:18:261296<div class="paragraph"><p><a href="git-add.html">git-add(1)</a>,
Junio C Hamanoe7935c42006-12-13 21:32:171297<a href="git-rm.html">git-rm(1)</a>,
1298<a href="git-mv.html">git-mv(1)</a>,
1299<a href="git-merge.html">git-merge(1)</a>,
Junio C Hamanoba4b9282008-07-06 05:20:311300<a href="git-commit-tree.html">git-commit-tree(1)</a></p></div>
Junio C Hamano40f2f8d2006-02-07 08:04:391301</div>
Junio C Hamanoba4b9282008-07-06 05:20:311302<h2 id="_git">GIT</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231303<div class="sectionbody">
Junio C Hamano60186642010-12-02 14:18:261304<div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231305</div>
Junio C Hamano7bd050f2011-09-22 06:32:221306</div>
1307<div id="footnotes"><hr /></div>
Junio C Hamano1a4e8412005-12-27 08:17:231308<div id="footer">
1309<div id="footer-text">
Junio C Hamanob76a6862012-05-02 22:02:461310Last updated 2012-05-02 15:00:44 PDT
Junio C Hamano1a4e8412005-12-27 08:17:231311</div>
1312</div>
1313</body>
1314</html>