Autogenerated HTML docs for v1.7.7-290-gc9e7aa
[git/jnareb-git.git] / git-commit.html
blob8349fcfec3f0e43a1e362f29cae3e21627a866b4
1 <!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" />
6 <meta name="generator" content="AsciiDoc 8.5.2" />
7 <title>git-commit(1)</title>
8 <style type="text/css">
9 /* Debug borders */
10 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
12 border: 1px solid red;
16 body {
17 margin: 1em 5% 1em 5%;
20 a {
21 color: blue;
22 text-decoration: underline;
24 a:visited {
25 color: fuchsia;
28 em {
29 font-style: italic;
30 color: navy;
33 strong {
34 font-weight: bold;
35 color: #083194;
38 tt {
39 color: navy;
42 h1, 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;
50 h1, h2, h3 {
51 border-bottom: 2px solid silver;
53 h2 {
54 padding-top: 0.5em;
56 h3 {
57 float: left;
59 h3 + * {
60 clear: left;
63 div.sectionbody {
64 font-family: serif;
65 margin-left: 0;
68 hr {
69 border: 1px solid silver;
72 p {
73 margin-top: 0.5em;
74 margin-bottom: 0.5em;
77 ul, ol, li > p {
78 margin-top: 0;
81 pre {
82 padding: 0;
83 margin: 0;
86 span#author {
87 color: #527bbd;
88 font-family: sans-serif;
89 font-weight: bold;
90 font-size: 1.1em;
92 span#email {
94 span#revnumber, span#revdate, span#revremark {
95 font-family: sans-serif;
98 div#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;
105 div#footer-text {
106 float: left;
107 padding-bottom: 0.5em;
109 div#footer-badges {
110 float: right;
111 padding-bottom: 0.5em;
114 div#preamble {
115 margin-top: 1.5em;
116 margin-bottom: 1.5em;
118 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
119 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
120 div.admonitionblock {
121 margin-top: 1.0em;
122 margin-bottom: 1.5em;
124 div.admonitionblock {
125 margin-top: 2.0em;
126 margin-bottom: 2.0em;
127 margin-right: 10%;
128 color: #606060;
131 div.content { /* Block element content. */
132 padding: 0;
135 /* Block element titles. */
136 div.title, caption.title {
137 color: #527bbd;
138 font-family: sans-serif;
139 font-weight: bold;
140 text-align: left;
141 margin-top: 1.0em;
142 margin-bottom: 0.5em;
144 div.title + * {
145 margin-top: 0;
148 td div.title:first-child {
149 margin-top: 0.0em;
151 div.content div.title:first-child {
152 margin-top: 0.0em;
154 div.content + div.title {
155 margin-top: 0.0em;
158 div.sidebarblock > div.content {
159 background: #ffffee;
160 border: 1px solid silver;
161 padding: 0.5em;
164 div.listingblock > div.content {
165 border: 1px solid silver;
166 background: #f4f4f4;
167 padding: 0.5em;
170 div.quoteblock, div.verseblock {
171 padding-left: 1.0em;
172 margin-left: 1.0em;
173 margin-right: 10%;
174 border-left: 5px solid #dddddd;
175 color: #777777;
178 div.quoteblock > div.attribution {
179 padding-top: 0.5em;
180 text-align: right;
183 div.verseblock > div.content {
184 white-space: pre;
186 div.verseblock > div.attribution {
187 padding-top: 0.75em;
188 text-align: left;
190 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
191 div.verseblock + div.attribution {
192 text-align: left;
195 div.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;
203 div.admonitionblock td.content {
204 padding-left: 0.5em;
205 border-left: 3px solid #dddddd;
208 div.exampleblock > div.content {
209 border-left: 3px solid #dddddd;
210 padding-left: 0.5em;
213 div.imageblock div.content { padding-left: 0; }
214 span.image img { border-style: none; }
215 a.image:visited { color: white; }
217 dl {
218 margin-top: 0.8em;
219 margin-bottom: 0.8em;
221 dt {
222 margin-top: 0.5em;
223 margin-bottom: 0;
224 font-style: normal;
225 color: navy;
227 dd > *:first-child {
228 margin-top: 0.1em;
231 ul, ol {
232 list-style-position: outside;
234 ol.arabic {
235 list-style-type: decimal;
237 ol.loweralpha {
238 list-style-type: lower-alpha;
240 ol.upperalpha {
241 list-style-type: upper-alpha;
243 ol.lowerroman {
244 list-style-type: lower-roman;
246 ol.upperroman {
247 list-style-type: upper-roman;
250 div.compact ul, div.compact ol,
251 div.compact p, div.compact p,
252 div.compact div, div.compact div {
253 margin-top: 0.1em;
254 margin-bottom: 0.1em;
257 div.tableblock > table {
258 border: 3px solid #527bbd;
260 thead, p.table.header {
261 font-family: sans-serif;
262 font-weight: bold;
264 tfoot {
265 font-weight: bold;
267 td > div.verse {
268 white-space: pre;
270 p.table {
271 margin-top: 0;
273 /* Because the table frame attribute is overriden by CSS in most browsers. */
274 div.tableblock > table[frame="void"] {
275 border-style: none;
277 div.tableblock > table[frame="hsides"] {
278 border-left-style: none;
279 border-right-style: none;
281 div.tableblock > table[frame="vsides"] {
282 border-top-style: none;
283 border-bottom-style: none;
287 div.hdlist {
288 margin-top: 0.8em;
289 margin-bottom: 0.8em;
291 div.hdlist tr {
292 padding-bottom: 15px;
294 dt.hdlist1.strong, td.hdlist1.strong {
295 font-weight: bold;
297 td.hdlist1 {
298 vertical-align: top;
299 font-style: normal;
300 padding-right: 0.8em;
301 color: navy;
303 td.hdlist2 {
304 vertical-align: top;
306 div.hdlist.compact tr {
307 margin: 0;
308 padding-bottom: 0;
311 .comment {
312 background: yellow;
315 .footnote, .footnoteref {
316 font-size: 0.8em;
319 span.footnote, span.footnoteref {
320 vertical-align: super;
323 #footnotes {
324 margin: 20px 0 20px 0;
325 padding: 7px 0 0 0;
328 #footnotes div.footnote {
329 margin: 0 0 5px 0;
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;
343 @media print {
344 div#footer-badges { display: none; }
347 div#toc {
348 margin-bottom: 2.5em;
351 div#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;
360 div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
361 margin-top: 0;
362 margin-bottom: 0;
364 div.toclevel2 {
365 margin-left: 2em;
366 font-size: 0.9em;
368 div.toclevel3 {
369 margin-left: 4em;
370 font-size: 0.9em;
372 div.toclevel4 {
373 margin-left: 6em;
374 font-size: 0.9em;
376 /* Overrides for manpage documents */
377 h1 {
378 padding-top: 0.5em;
379 padding-bottom: 0.5em;
380 border-top: 2px solid silver;
381 border-bottom: 2px solid silver;
383 h2 {
384 border-style: none;
386 div.sectionbody {
387 margin-left: 5%;
390 @media print {
391 div#toc { display: none; }
394 /* Workarounds for IE6's broken and incomplete CSS2. */
396 div.sidebar-content {
397 background: #ffffee;
398 border: 1px solid silver;
399 padding: 0.5em;
401 div.sidebar-title, div.image-title {
402 color: #527bbd;
403 font-family: sans-serif;
404 font-weight: bold;
405 margin-top: 0.0em;
406 margin-bottom: 0.5em;
409 div.listingblock div.content {
410 border: 1px solid silver;
411 background: #f4f4f4;
412 padding: 0.5em;
415 div.quoteblock-attribution {
416 padding-top: 0.5em;
417 text-align: right;
420 div.verseblock-content {
421 white-space: pre;
423 div.verseblock-attribution {
424 padding-top: 0.75em;
425 text-align: left;
428 div.exampleblock-content {
429 border-left: 3px solid #dddddd;
430 padding-left: 0.5em;
433 /* IE6 sets dynamically generated links as visited. */
434 div#toc a:visited { color: blue; }
435 </style>
436 <script type="text/javascript">
437 /*<![CDATA[*/
438 window.onload = function(){asciidoc.footnotes();}
439 var asciidoc = { // Namespace.
441 /////////////////////////////////////////////////////////////////////
442 // Table Of Contents generator
443 /////////////////////////////////////////////////////////////////////
445 /* Author: Mihai Bazon, September 2002
446 * http://students.infoiasi.ro/~mishoo
448 * Table Of Content generator
449 * Version: 0.4
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.
455 /* modified by Troy D. Hanson, September 2006. License: GPL */
456 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
458 // toclevels = 1..4.
459 toc: function (toclevels) {
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);
469 return text;
472 function TocEntry(el, text, toclevel) {
473 this.element = el;
474 this.text = text;
475 this.toclevel = toclevel;
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);
491 iterate(i);
495 iterate(el);
496 return result;
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);
513 if (entries.length == 0)
514 toc.parentNode.removeChild(toc);
518 /////////////////////////////////////////////////////////////////////
519 // Footnotes generator
520 /////////////////////////////////////////////////////////////////////
522 /* Based on footnote generation code from:
523 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
526 footnotes: 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;
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>]";
567 /*]]>*/
568 </script>
569 </head>
570 <body>
571 <div id="header">
572 <h1>
573 git-commit(1) Manual Page
574 </h1>
575 <h2>NAME</h2>
576 <div class="sectionbody">
577 <p>git-commit -
578 Record changes to the repository
579 </p>
580 </div>
581 </div>
582 <div id="content">
583 <h2 id="_synopsis">SYNOPSIS</h2>
584 <div class="sectionbody">
585 <div class="verseblock">
586 <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>
592 <div class="verseblock-attribution">
593 </div></div>
594 </div>
595 <h2 id="_description">DESCRIPTION</h2>
596 <div class="sectionbody">
597 <div class="paragraph"><p>Stores the current contents of the index in a new commit along
598 with a log message from the user describing the changes.</p></div>
599 <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">
601 <li>
603 by using <em>git add</em> to incrementally "add" changes to the
604 index before using the <em>commit</em> command (Note: even modified
605 files must be "added");
606 </p>
607 </li>
608 <li>
610 by using <em>git rm</em> to remove files from the working tree
611 and the index, again before using the <em>commit</em> command;
612 </p>
613 </li>
614 <li>
616 by 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
618 record the current content of the listed files (which must already
619 be known to git);
620 </p>
621 </li>
622 <li>
624 by 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;
629 </p>
630 </li>
631 <li>
633 by 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,
635 before finalizing the operation. See the <tt>`Interactive Mode</tt>` section of
636 <a href="git-add.html">git-add(1)</a> to learn how to operate these modes.
637 </p>
638 </li>
639 </ol></div>
640 <div class="paragraph"><p>The <tt>--dry-run</tt> option can be used to obtain a
641 summary of what is included by any of the above for the next
642 commit by giving the same set of parameters (options and paths).</p></div>
643 <div class="paragraph"><p>If you make a commit and then find a mistake immediately after
644 that, you can recover from it with <em>git reset</em>.</p></div>
645 </div>
646 <h2 id="_options">OPTIONS</h2>
647 <div class="sectionbody">
648 <div class="dlist"><dl>
649 <dt class="hdlist1">
651 </dt>
652 <dt class="hdlist1">
653 --all
654 </dt>
655 <dd>
657 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.
660 </p>
661 </dd>
662 <dt class="hdlist1">
664 </dt>
665 <dt class="hdlist1">
666 --patch
667 </dt>
668 <dd>
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">
676 -C &lt;commit&gt;
677 </dt>
678 <dt class="hdlist1">
679 --reuse-message=&lt;commit&gt;
680 </dt>
681 <dd>
683 Take an existing commit object, and reuse the log message
684 and the authorship information (including the timestamp)
685 when creating the commit.
686 </p>
687 </dd>
688 <dt class="hdlist1">
689 -c &lt;commit&gt;
690 </dt>
691 <dt class="hdlist1">
692 --reedit-message=&lt;commit&gt;
693 </dt>
694 <dd>
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.
698 </p>
699 </dd>
700 <dt class="hdlist1">
701 --fixup=&lt;commit&gt;
702 </dt>
703 <dd>
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>
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">
724 --reset-author
725 </dt>
726 <dd>
728 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.
732 </p>
733 </dd>
734 <dt class="hdlist1">
735 --short
736 </dt>
737 <dd>
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>
743 <dt class="hdlist1">
744 --porcelain
745 </dt>
746 <dd>
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>
753 <dt class="hdlist1">
755 </dt>
756 <dd>
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>
763 <dt class="hdlist1">
764 -F &lt;file&gt;
765 </dt>
766 <dt class="hdlist1">
767 --file=&lt;file&gt;
768 </dt>
769 <dd>
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>
775 <dt class="hdlist1">
776 --author=&lt;author&gt;
777 </dt>
778 <dd>
780 Override the commit author. Specify an explicit author using the
781 standard <tt>A U Thor &lt;<a href="mailto:author@example.com">author@example.com</a>&gt;</tt> format. Otherwise &lt;author&gt;
782 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.
785 </p>
786 </dd>
787 <dt class="hdlist1">
788 --date=&lt;date&gt;
789 </dt>
790 <dd>
792 Override the author date used in the commit.
793 </p>
794 </dd>
795 <dt class="hdlist1">
796 -m &lt;msg&gt;
797 </dt>
798 <dt class="hdlist1">
799 --message=&lt;msg&gt;
800 </dt>
801 <dd>
803 Use the given &lt;msg&gt; as the commit message.
804 </p>
805 </dd>
806 <dt class="hdlist1">
807 -t &lt;file&gt;
808 </dt>
809 <dt class="hdlist1">
810 --template=&lt;file&gt;
811 </dt>
812 <dd>
814 Use the contents of the given file as the initial version
815 of the commit message. The editor is invoked and you can
816 make subsequent changes. If a message is specified using
817 the <tt>-m</tt> or <tt>-F</tt> options, this option has no effect. This
818 overrides the <tt>commit.template</tt> configuration variable.
819 </p>
820 </dd>
821 <dt class="hdlist1">
823 </dt>
824 <dt class="hdlist1">
825 --signoff
826 </dt>
827 <dd>
829 Add Signed-off-by line by the committer at the end of the commit
830 log message.
831 </p>
832 </dd>
833 <dt class="hdlist1">
835 </dt>
836 <dt class="hdlist1">
837 --no-verify
838 </dt>
839 <dd>
841 This option bypasses the pre-commit and commit-msg hooks.
842 See also <a href="githooks.html">githooks(5)</a>.
843 </p>
844 </dd>
845 <dt class="hdlist1">
846 --allow-empty
847 </dt>
848 <dd>
850 Usually recording a commit that has the exact same tree as its
851 sole parent commit is a mistake, and the command prevents you
852 from making such a commit. This option bypasses the safety, and
853 is primarily for use by foreign SCM interface scripts.
854 </p>
855 </dd>
856 <dt class="hdlist1">
857 --allow-empty-message
858 </dt>
859 <dd>
861 Like --allow-empty this command is primarily for use by foreign
862 SCM interface scripts. It allows you to create a commit with an
863 empty commit message without using plumbing commands like
864 <a href="git-commit-tree.html">git-commit-tree(1)</a>.
865 </p>
866 </dd>
867 <dt class="hdlist1">
868 --cleanup=&lt;mode&gt;
869 </dt>
870 <dd>
872 This option sets how the commit message is cleaned up.
873 The <em>&lt;mode&gt;</em> can be one of <em>verbatim</em>, <em>whitespace</em>, <em>strip</em>,
874 and <em>default</em>. The <em>default</em> mode will strip leading and
875 trailing empty lines and #commentary from the commit message
876 only if the message is to be edited. Otherwise only whitespace
877 removed. The <em>verbatim</em> mode does not change message at all,
878 <em>whitespace</em> removes just leading/trailing whitespace lines
879 and <em>strip</em> removes both whitespace and commentary.
880 </p>
881 </dd>
882 <dt class="hdlist1">
884 </dt>
885 <dt class="hdlist1">
886 --edit
887 </dt>
888 <dd>
890 The message taken from file with <tt>-F</tt>, command line with
891 <tt>-m</tt>, and from file with <tt>-C</tt> are usually used as the
892 commit log message unmodified. This option lets you
893 further edit the message taken from these sources.
894 </p>
895 </dd>
896 <dt class="hdlist1">
897 --amend
898 </dt>
899 <dd>
901 Used to amend the tip of the current branch. Prepare the tree
902 object you would want to replace the latest commit as usual
903 (this includes the usual -i/-o and explicit paths), and the
904 commit log editor is seeded with the commit message from the
905 tip of the current branch. The commit you create replaces the
906 current tip&#8201;&#8212;&#8201;if it was a merge, it will have the parents of
907 the current tip as parents&#8201;&#8212;&#8201;so the current top commit is
908 discarded.
909 </p>
910 <div class="paragraph"><p>It is a rough equivalent for:</p></div>
911 <div class="listingblock">
912 <div class="content">
913 <pre><tt> $ git reset --soft HEAD^
914 $ ... do something else to come up with the right tree ...
915 $ git commit -c ORIG_HEAD</tt></pre>
916 </div></div>
917 <div class="paragraph"><p>but can be used to amend a merge commit.</p></div>
918 <div class="paragraph"><p>You should understand the implications of rewriting history if you
919 amend a commit that has already been published. (See the "RECOVERING
920 FROM UPSTREAM REBASE" section in <a href="git-rebase.html">git-rebase(1)</a>.)</p></div>
921 </dd>
922 <dt class="hdlist1">
924 </dt>
925 <dt class="hdlist1">
926 --include
927 </dt>
928 <dd>
930 Before making a commit out of staged contents so far,
931 stage the contents of paths given on the command line
932 as well. This is usually not what you want unless you
933 are concluding a conflicted merge.
934 </p>
935 </dd>
936 <dt class="hdlist1">
938 </dt>
939 <dt class="hdlist1">
940 --only
941 </dt>
942 <dd>
944 Make a commit only from the paths specified on the
945 command line, disregarding any contents that have been
946 staged so far. This is the default mode of operation of
947 <em>git commit</em> if any paths are given on the command line,
948 in which case this option can be omitted.
949 If this option is specified together with <em>--amend</em>, then
950 no paths need to be specified, which can be used to amend
951 the last commit without committing changes that have
952 already been staged.
953 </p>
954 </dd>
955 <dt class="hdlist1">
956 -u[&lt;mode&gt;]
957 </dt>
958 <dt class="hdlist1">
959 --untracked-files[=&lt;mode&gt;]
960 </dt>
961 <dd>
963 Show untracked files.
964 </p>
965 <div class="paragraph"><p>The mode parameter is optional (defaults to <em>all</em>), and is used to
966 specify the handling of untracked files; when -u is not used, the
967 default is <em>normal</em>, i.e. show untracked files and directories.</p></div>
968 <div class="paragraph"><p>The possible options are:</p></div>
969 <div class="ulist"><ul>
970 <li>
972 <em>no</em> - Show no untracked files
973 </p>
974 </li>
975 <li>
977 <em>normal</em> - Shows untracked files and directories
978 </p>
979 </li>
980 <li>
982 <em>all</em> - Also shows individual files in untracked directories.
983 </p>
984 <div class="paragraph"><p>The default can be changed using the status.showUntrackedFiles
985 configuration variable documented in <a href="git-config.html">git-config(1)</a>.</p></div>
986 </li>
987 </ul></div>
988 </dd>
989 <dt class="hdlist1">
991 </dt>
992 <dt class="hdlist1">
993 --verbose
994 </dt>
995 <dd>
997 Show unified diff between the HEAD commit and what
998 would be committed at the bottom of the commit message
999 template. Note that this diff output doesn&#8217;t have its
1000 lines prefixed with <em>#</em>.
1001 </p>
1002 </dd>
1003 <dt class="hdlist1">
1005 </dt>
1006 <dt class="hdlist1">
1007 --quiet
1008 </dt>
1009 <dd>
1011 Suppress commit summary message.
1012 </p>
1013 </dd>
1014 <dt class="hdlist1">
1015 --dry-run
1016 </dt>
1017 <dd>
1019 Do not create a commit, but show a list of paths that are
1020 to be committed, paths with local changes that will be left
1021 uncommitted and paths that are untracked.
1022 </p>
1023 </dd>
1024 <dt class="hdlist1">
1025 --status
1026 </dt>
1027 <dd>
1029 Include the output of <a href="git-status.html">git-status(1)</a> in the commit
1030 message template when using an editor to prepare the commit
1031 message. Defaults to on, but can be used to override
1032 configuration variable commit.status.
1033 </p>
1034 </dd>
1035 <dt class="hdlist1">
1036 --no-status
1037 </dt>
1038 <dd>
1040 Do not include the output of <a href="git-status.html">git-status(1)</a> in the
1041 commit message template when using an editor to prepare the
1042 default commit message.
1043 </p>
1044 </dd>
1045 <dt class="hdlist1">
1047 </dt>
1048 <dd>
1050 Do not interpret any more arguments as options.
1051 </p>
1052 </dd>
1053 <dt class="hdlist1">
1054 &lt;file&gt;&#8230;
1055 </dt>
1056 <dd>
1058 When files are given on the command line, the command
1059 commits the contents of the named files, without
1060 recording the changes already staged. The contents of
1061 these files are also staged for the next commit on top
1062 of what have been staged before.
1063 </p>
1064 </dd>
1065 </dl></div>
1066 </div>
1067 <h2 id="_date_formats">DATE FORMATS</h2>
1068 <div class="sectionbody">
1069 <div class="paragraph"><p>The GIT_AUTHOR_DATE, GIT_COMMITTER_DATE environment variables
1070 and the <tt>--date</tt> option
1071 support the following date formats:</p></div>
1072 <div class="dlist"><dl>
1073 <dt class="hdlist1">
1074 Git internal format
1075 </dt>
1076 <dd>
1078 It is <tt>&lt;unix timestamp&gt; &lt;timezone offset&gt;</tt>, where <tt>&lt;unix
1079 timestamp&gt;</tt> is the number of seconds since the UNIX epoch.
1080 <tt>&lt;timezone offset&gt;</tt> is a positive or negative offset from UTC.
1081 For example CET (which is 2 hours ahead UTC) is <tt>+0200</tt>.
1082 </p>
1083 </dd>
1084 <dt class="hdlist1">
1085 RFC 2822
1086 </dt>
1087 <dd>
1089 The standard email format as described by RFC 2822, for example
1090 <tt>Thu, 07 Apr 2005 22:13:13 +0200</tt>.
1091 </p>
1092 </dd>
1093 <dt class="hdlist1">
1094 ISO 8601
1095 </dt>
1096 <dd>
1098 Time and date specified by the ISO 8601 standard, for example
1099 <tt>2005-04-07T22:13:13</tt>. The parser accepts a space instead of the
1100 <tt>T</tt> character as well.
1101 </p>
1102 <div class="admonitionblock">
1103 <table><tr>
1104 <td class="icon">
1105 <div class="title">Note</div>
1106 </td>
1107 <td class="content">In addition, the date part is accepted in the following formats:
1108 <tt>YYYY.MM.DD</tt>, <tt>MM/DD/YYYY</tt> and <tt>DD.MM.YYYY</tt>.</td>
1109 </tr></table>
1110 </div>
1111 </dd>
1112 </dl></div>
1113 </div>
1114 <h2 id="_examples">EXAMPLES</h2>
1115 <div class="sectionbody">
1116 <div class="paragraph"><p>When recording your own work, the contents of modified files in
1117 your working tree are temporarily stored to a staging area
1118 called the "index" with <em>git add</em>. A file can be
1119 reverted back, only in the index but not in the working tree,
1120 to that of the last commit with <tt>git reset HEAD -- &lt;file&gt;</tt>,
1121 which effectively reverts <em>git add</em> and prevents the changes to
1122 this file from participating in the next commit. After building
1123 the state to be committed incrementally with these commands,
1124 <tt>git commit</tt> (without any pathname parameter) is used to record what
1125 has been staged so far. This is the most basic form of the
1126 command. An example:</p></div>
1127 <div class="listingblock">
1128 <div class="content">
1129 <pre><tt>$ edit hello.c
1130 $ git rm goodbye.c
1131 $ git add hello.c
1132 $ git commit</tt></pre>
1133 </div></div>
1134 <div class="paragraph"><p>Instead of staging files after each individual change, you can
1135 tell <tt>git commit</tt> to notice the changes to the files whose
1136 contents are tracked in
1137 your working tree and do corresponding <tt>git add</tt> and <tt>git rm</tt>
1138 for you. That is, this example does the same as the earlier
1139 example if there is no other change in your working tree:</p></div>
1140 <div class="listingblock">
1141 <div class="content">
1142 <pre><tt>$ edit hello.c
1143 $ rm goodbye.c
1144 $ git commit -a</tt></pre>
1145 </div></div>
1146 <div class="paragraph"><p>The command <tt>git commit -a</tt> first looks at your working tree,
1147 notices that you have modified hello.c and removed goodbye.c,
1148 and performs necessary <tt>git add</tt> and <tt>git rm</tt> for you.</p></div>
1149 <div class="paragraph"><p>After staging changes to many files, you can alter the order the
1150 changes are recorded in, by giving pathnames to <tt>git commit</tt>.
1151 When pathnames are given, the command makes a commit that
1152 only records the changes made to the named paths:</p></div>
1153 <div class="listingblock">
1154 <div class="content">
1155 <pre><tt>$ edit hello.c hello.h
1156 $ git add hello.c hello.h
1157 $ edit Makefile
1158 $ git commit Makefile</tt></pre>
1159 </div></div>
1160 <div class="paragraph"><p>This makes a commit that records the modification to <tt>Makefile</tt>.
1161 The changes staged for <tt>hello.c</tt> and <tt>hello.h</tt> are not included
1162 in the resulting commit. However, their changes are not lost&#8201;&#8212;&#8201;they are still staged and merely held back. After the above
1163 sequence, if you do:</p></div>
1164 <div class="listingblock">
1165 <div class="content">
1166 <pre><tt>$ git commit</tt></pre>
1167 </div></div>
1168 <div class="paragraph"><p>this second commit would record the changes to <tt>hello.c</tt> and
1169 <tt>hello.h</tt> as expected.</p></div>
1170 <div class="paragraph"><p>After a merge (initiated by <em>git merge</em> or <em>git pull</em>) stops
1171 because of conflicts, cleanly merged
1172 paths are already staged to be committed for you, and paths that
1173 conflicted are left in unmerged state. You would have to first
1174 check which paths are conflicting with <em>git status</em>
1175 and after fixing them manually in your working tree, you would
1176 stage the result as usual with <em>git add</em>:</p></div>
1177 <div class="listingblock">
1178 <div class="content">
1179 <pre><tt>$ git status | grep unmerged
1180 unmerged: hello.c
1181 $ edit hello.c
1182 $ git add hello.c</tt></pre>
1183 </div></div>
1184 <div class="paragraph"><p>After resolving conflicts and staging the result, <tt>git ls-files -u</tt>
1185 would stop mentioning the conflicted path. When you are done,
1186 run <tt>git commit</tt> to finally record the merge:</p></div>
1187 <div class="listingblock">
1188 <div class="content">
1189 <pre><tt>$ git commit</tt></pre>
1190 </div></div>
1191 <div class="paragraph"><p>As with the case to record your own changes, you can use <tt>-a</tt>
1192 option to save typing. One difference is that during a merge
1193 resolution, you cannot use <tt>git commit</tt> with pathnames to
1194 alter the order the changes are committed, because the merge
1195 should be recorded as a single commit. In fact, the command
1196 refuses to run when given pathnames (but see <tt>-i</tt> option).</p></div>
1197 </div>
1198 <h2 id="_discussion">DISCUSSION</h2>
1199 <div class="sectionbody">
1200 <div class="paragraph"><p>Though not required, it&#8217;s a good idea to begin the commit message
1201 with a single short (less than 50 character) line summarizing the
1202 change, followed by a blank line and then a more thorough description.
1203 Tools that turn commits into email, for example, use the first line
1204 on the Subject: line and the rest of the commit in the body.</p></div>
1205 <div class="paragraph"><p>At the core level, git is character encoding agnostic.</p></div>
1206 <div class="ulist"><ul>
1207 <li>
1209 The pathnames recorded in the index and in the tree objects
1210 are treated as uninterpreted sequences of non-NUL bytes.
1211 What readdir(2) returns are what are recorded and compared
1212 with the data git keeps track of, which in turn are expected
1213 to be what lstat(2) and creat(2) accepts. There is no such
1214 thing as pathname encoding translation.
1215 </p>
1216 </li>
1217 <li>
1219 The contents of the blob objects are uninterpreted sequences
1220 of bytes. There is no encoding translation at the core
1221 level.
1222 </p>
1223 </li>
1224 <li>
1226 The commit log messages are uninterpreted sequences of non-NUL
1227 bytes.
1228 </p>
1229 </li>
1230 </ul></div>
1231 <div class="paragraph"><p>Although we encourage that the commit log messages are encoded
1232 in UTF-8, both the core and git Porcelain are designed not to
1233 force UTF-8 on projects. If all participants of a particular
1234 project find it more convenient to use legacy encodings, git
1235 does not forbid it. However, there are a few things to keep in
1236 mind.</p></div>
1237 <div class="olist arabic"><ol class="arabic">
1238 <li>
1240 <em>git commit</em> and <em>git commit-tree</em> issues
1241 a warning if the commit log message given to it does not look
1242 like a valid UTF-8 string, unless you explicitly say your
1243 project uses a legacy encoding. The way to say this is to
1244 have i18n.commitencoding in <tt>.git/config</tt> file, like this:
1245 </p>
1246 <div class="listingblock">
1247 <div class="content">
1248 <pre><tt>[i18n]
1249 commitencoding = ISO-8859-1</tt></pre>
1250 </div></div>
1251 <div class="paragraph"><p>Commit objects created with the above setting record the value
1252 of <tt>i18n.commitencoding</tt> in its <tt>encoding</tt> header. This is to
1253 help other people who look at them later. Lack of this header
1254 implies that the commit log message is encoded in UTF-8.</p></div>
1255 </li>
1256 <li>
1258 <em>git log</em>, <em>git show</em>, <em>git blame</em> and friends look at the
1259 <tt>encoding</tt> header of a commit object, and try to re-code the
1260 log message into UTF-8 unless otherwise specified. You can
1261 specify the desired output encoding with
1262 <tt>i18n.logoutputencoding</tt> in <tt>.git/config</tt> file, like this:
1263 </p>
1264 <div class="listingblock">
1265 <div class="content">
1266 <pre><tt>[i18n]
1267 logoutputencoding = ISO-8859-1</tt></pre>
1268 </div></div>
1269 <div class="paragraph"><p>If you do not have this configuration variable, the value of
1270 <tt>i18n.commitencoding</tt> is used instead.</p></div>
1271 </li>
1272 </ol></div>
1273 <div class="paragraph"><p>Note that we deliberately chose not to re-code the commit log
1274 message when a commit is made to force UTF-8 at the commit
1275 object level, because re-coding to UTF-8 is not necessarily a
1276 reversible operation.</p></div>
1277 </div>
1278 <h2 id="_environment_and_configuration_variables">ENVIRONMENT AND CONFIGURATION VARIABLES</h2>
1279 <div class="sectionbody">
1280 <div class="paragraph"><p>The editor used to edit the commit log message will be chosen from the
1281 GIT_EDITOR environment variable, the core.editor configuration variable, the
1282 VISUAL environment variable, or the EDITOR environment variable (in that
1283 order). See <a href="git-var.html">git-var(1)</a> for details.</p></div>
1284 </div>
1285 <h2 id="_hooks">HOOKS</h2>
1286 <div class="sectionbody">
1287 <div class="paragraph"><p>This command can run <tt>commit-msg</tt>, <tt>prepare-commit-msg</tt>, <tt>pre-commit</tt>,
1288 and <tt>post-commit</tt> hooks. See <a href="githooks.html">githooks(5)</a> for more
1289 information.</p></div>
1290 </div>
1291 <h2 id="_see_also">SEE ALSO</h2>
1292 <div class="sectionbody">
1293 <div class="paragraph"><p><a href="git-add.html">git-add(1)</a>,
1294 <a href="git-rm.html">git-rm(1)</a>,
1295 <a href="git-mv.html">git-mv(1)</a>,
1296 <a href="git-merge.html">git-merge(1)</a>,
1297 <a href="git-commit-tree.html">git-commit-tree(1)</a></p></div>
1298 </div>
1299 <h2 id="_git">GIT</h2>
1300 <div class="sectionbody">
1301 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
1302 </div>
1303 </div>
1304 <div id="footnotes"><hr /></div>
1305 <div id="footer">
1306 <div id="footer-text">
1307 Last updated 2011-09-21 23:01:14 PDT
1308 </div>
1309 </div>
1310 </body>
1311 </html>