Autogenerated HTML docs for v2.45.1-204-gd8ab1
[git-htmldocs.git] / git-commit.html
blob1def0d8ef1d4075253515b38fd1b2f4ee47ff206
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
5 <head>
6 <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
7 <meta name="generator" content="AsciiDoc 10.2.0" />
8 <title>git-commit(1)</title>
9 <style type="text/css">
10 /* Shared CSS for AsciiDoc xhtml11 and html5 backends */
12 /* Default font. */
13 body {
14 font-family: Georgia,serif;
17 /* Title font. */
18 h1, h2, h3, h4, h5, h6,
19 div.title, caption.title,
20 thead, p.table.header,
21 #toctitle,
22 #author, #revnumber, #revdate, #revremark,
23 #footer {
24 font-family: Arial,Helvetica,sans-serif;
27 body {
28 margin: 1em 5% 1em 5%;
31 a {
32 color: blue;
33 text-decoration: underline;
35 a:visited {
36 color: fuchsia;
39 em {
40 font-style: italic;
41 color: navy;
44 strong {
45 font-weight: bold;
46 color: #083194;
49 h1, h2, h3, h4, h5, h6 {
50 color: #527bbd;
51 margin-top: 1.2em;
52 margin-bottom: 0.5em;
53 line-height: 1.3;
56 h1, h2, h3 {
57 border-bottom: 2px solid silver;
59 h2 {
60 padding-top: 0.5em;
62 h3 {
63 float: left;
65 h3 + * {
66 clear: left;
68 h5 {
69 font-size: 1.0em;
72 div.sectionbody {
73 margin-left: 0;
76 hr {
77 border: 1px solid silver;
80 p {
81 margin-top: 0.5em;
82 margin-bottom: 0.5em;
85 ul, ol, li > p {
86 margin-top: 0;
88 ul > li { color: #aaa; }
89 ul > li > * { color: black; }
91 .monospaced, code, pre {
92 font-family: "Courier New", Courier, monospace;
93 font-size: inherit;
94 color: navy;
95 padding: 0;
96 margin: 0;
98 pre {
99 white-space: pre-wrap;
102 #author {
103 color: #527bbd;
104 font-weight: bold;
105 font-size: 1.1em;
107 #email {
109 #revnumber, #revdate, #revremark {
112 #footer {
113 font-size: small;
114 border-top: 2px solid silver;
115 padding-top: 0.5em;
116 margin-top: 4.0em;
118 #footer-text {
119 float: left;
120 padding-bottom: 0.5em;
122 #footer-badges {
123 float: right;
124 padding-bottom: 0.5em;
127 #preamble {
128 margin-top: 1.5em;
129 margin-bottom: 1.5em;
131 div.imageblock, div.exampleblock, div.verseblock,
132 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
133 div.admonitionblock {
134 margin-top: 1.0em;
135 margin-bottom: 1.5em;
137 div.admonitionblock {
138 margin-top: 2.0em;
139 margin-bottom: 2.0em;
140 margin-right: 10%;
141 color: #606060;
144 div.content { /* Block element content. */
145 padding: 0;
148 /* Block element titles. */
149 div.title, caption.title {
150 color: #527bbd;
151 font-weight: bold;
152 text-align: left;
153 margin-top: 1.0em;
154 margin-bottom: 0.5em;
156 div.title + * {
157 margin-top: 0;
160 td div.title:first-child {
161 margin-top: 0.0em;
163 div.content div.title:first-child {
164 margin-top: 0.0em;
166 div.content + div.title {
167 margin-top: 0.0em;
170 div.sidebarblock > div.content {
171 background: #ffffee;
172 border: 1px solid #dddddd;
173 border-left: 4px solid #f0f0f0;
174 padding: 0.5em;
177 div.listingblock > div.content {
178 border: 1px solid #dddddd;
179 border-left: 5px solid #f0f0f0;
180 background: #f8f8f8;
181 padding: 0.5em;
184 div.quoteblock, div.verseblock {
185 padding-left: 1.0em;
186 margin-left: 1.0em;
187 margin-right: 10%;
188 border-left: 5px solid #f0f0f0;
189 color: #888;
192 div.quoteblock > div.attribution {
193 padding-top: 0.5em;
194 text-align: right;
197 div.verseblock > pre.content {
198 font-family: inherit;
199 font-size: inherit;
201 div.verseblock > div.attribution {
202 padding-top: 0.75em;
203 text-align: left;
205 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
206 div.verseblock + div.attribution {
207 text-align: left;
210 div.admonitionblock .icon {
211 vertical-align: top;
212 font-size: 1.1em;
213 font-weight: bold;
214 text-decoration: underline;
215 color: #527bbd;
216 padding-right: 0.5em;
218 div.admonitionblock td.content {
219 padding-left: 0.5em;
220 border-left: 3px solid #dddddd;
223 div.exampleblock > div.content {
224 border-left: 3px solid #dddddd;
225 padding-left: 0.5em;
228 div.imageblock div.content { padding-left: 0; }
229 span.image img { border-style: none; vertical-align: text-bottom; }
230 a.image:visited { color: white; }
232 dl {
233 margin-top: 0.8em;
234 margin-bottom: 0.8em;
236 dt {
237 margin-top: 0.5em;
238 margin-bottom: 0;
239 font-style: normal;
240 color: navy;
242 dd > *:first-child {
243 margin-top: 0.1em;
246 ul, ol {
247 list-style-position: outside;
249 ol.arabic {
250 list-style-type: decimal;
252 ol.loweralpha {
253 list-style-type: lower-alpha;
255 ol.upperalpha {
256 list-style-type: upper-alpha;
258 ol.lowerroman {
259 list-style-type: lower-roman;
261 ol.upperroman {
262 list-style-type: upper-roman;
265 div.compact ul, div.compact ol,
266 div.compact p, div.compact p,
267 div.compact div, div.compact div {
268 margin-top: 0.1em;
269 margin-bottom: 0.1em;
272 tfoot {
273 font-weight: bold;
275 td > div.verse {
276 white-space: pre;
279 div.hdlist {
280 margin-top: 0.8em;
281 margin-bottom: 0.8em;
283 div.hdlist tr {
284 padding-bottom: 15px;
286 dt.hdlist1.strong, td.hdlist1.strong {
287 font-weight: bold;
289 td.hdlist1 {
290 vertical-align: top;
291 font-style: normal;
292 padding-right: 0.8em;
293 color: navy;
295 td.hdlist2 {
296 vertical-align: top;
298 div.hdlist.compact tr {
299 margin: 0;
300 padding-bottom: 0;
303 .comment {
304 background: yellow;
307 .footnote, .footnoteref {
308 font-size: 0.8em;
311 span.footnote, span.footnoteref {
312 vertical-align: super;
315 #footnotes {
316 margin: 20px 0 20px 0;
317 padding: 7px 0 0 0;
320 #footnotes div.footnote {
321 margin: 0 0 5px 0;
324 #footnotes hr {
325 border: none;
326 border-top: 1px solid silver;
327 height: 1px;
328 text-align: left;
329 margin-left: 0;
330 width: 20%;
331 min-width: 100px;
334 div.colist td {
335 padding-right: 0.5em;
336 padding-bottom: 0.3em;
337 vertical-align: top;
339 div.colist td img {
340 margin-top: 0.3em;
343 @media print {
344 #footer-badges { display: none; }
347 #toc {
348 margin-bottom: 2.5em;
351 #toctitle {
352 color: #527bbd;
353 font-size: 1.1em;
354 font-weight: bold;
355 margin-top: 1.0em;
356 margin-bottom: 0.1em;
359 div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
360 margin-top: 0;
361 margin-bottom: 0;
363 div.toclevel2 {
364 margin-left: 2em;
365 font-size: 0.9em;
367 div.toclevel3 {
368 margin-left: 4em;
369 font-size: 0.9em;
371 div.toclevel4 {
372 margin-left: 6em;
373 font-size: 0.9em;
376 span.aqua { color: aqua; }
377 span.black { color: black; }
378 span.blue { color: blue; }
379 span.fuchsia { color: fuchsia; }
380 span.gray { color: gray; }
381 span.green { color: green; }
382 span.lime { color: lime; }
383 span.maroon { color: maroon; }
384 span.navy { color: navy; }
385 span.olive { color: olive; }
386 span.purple { color: purple; }
387 span.red { color: red; }
388 span.silver { color: silver; }
389 span.teal { color: teal; }
390 span.white { color: white; }
391 span.yellow { color: yellow; }
393 span.aqua-background { background: aqua; }
394 span.black-background { background: black; }
395 span.blue-background { background: blue; }
396 span.fuchsia-background { background: fuchsia; }
397 span.gray-background { background: gray; }
398 span.green-background { background: green; }
399 span.lime-background { background: lime; }
400 span.maroon-background { background: maroon; }
401 span.navy-background { background: navy; }
402 span.olive-background { background: olive; }
403 span.purple-background { background: purple; }
404 span.red-background { background: red; }
405 span.silver-background { background: silver; }
406 span.teal-background { background: teal; }
407 span.white-background { background: white; }
408 span.yellow-background { background: yellow; }
410 span.big { font-size: 2em; }
411 span.small { font-size: 0.6em; }
413 span.underline { text-decoration: underline; }
414 span.overline { text-decoration: overline; }
415 span.line-through { text-decoration: line-through; }
417 div.unbreakable { page-break-inside: avoid; }
421 * xhtml11 specific
423 * */
425 div.tableblock {
426 margin-top: 1.0em;
427 margin-bottom: 1.5em;
429 div.tableblock > table {
430 border: 3px solid #527bbd;
432 thead, p.table.header {
433 font-weight: bold;
434 color: #527bbd;
436 p.table {
437 margin-top: 0;
439 /* Because the table frame attribute is overridden by CSS in most browsers. */
440 div.tableblock > table[frame="void"] {
441 border-style: none;
443 div.tableblock > table[frame="hsides"] {
444 border-left-style: none;
445 border-right-style: none;
447 div.tableblock > table[frame="vsides"] {
448 border-top-style: none;
449 border-bottom-style: none;
454 * html5 specific
456 * */
458 table.tableblock {
459 margin-top: 1.0em;
460 margin-bottom: 1.5em;
462 thead, p.tableblock.header {
463 font-weight: bold;
464 color: #527bbd;
466 p.tableblock {
467 margin-top: 0;
469 table.tableblock {
470 border-width: 3px;
471 border-spacing: 0px;
472 border-style: solid;
473 border-color: #527bbd;
474 border-collapse: collapse;
476 th.tableblock, td.tableblock {
477 border-width: 1px;
478 padding: 4px;
479 border-style: solid;
480 border-color: #527bbd;
483 table.tableblock.frame-topbot {
484 border-left-style: hidden;
485 border-right-style: hidden;
487 table.tableblock.frame-sides {
488 border-top-style: hidden;
489 border-bottom-style: hidden;
491 table.tableblock.frame-none {
492 border-style: hidden;
495 th.tableblock.halign-left, td.tableblock.halign-left {
496 text-align: left;
498 th.tableblock.halign-center, td.tableblock.halign-center {
499 text-align: center;
501 th.tableblock.halign-right, td.tableblock.halign-right {
502 text-align: right;
505 th.tableblock.valign-top, td.tableblock.valign-top {
506 vertical-align: top;
508 th.tableblock.valign-middle, td.tableblock.valign-middle {
509 vertical-align: middle;
511 th.tableblock.valign-bottom, td.tableblock.valign-bottom {
512 vertical-align: bottom;
517 * manpage specific
519 * */
521 body.manpage h1 {
522 padding-top: 0.5em;
523 padding-bottom: 0.5em;
524 border-top: 2px solid silver;
525 border-bottom: 2px solid silver;
527 body.manpage h2 {
528 border-style: none;
530 body.manpage div.sectionbody {
531 margin-left: 3em;
534 @media print {
535 body.manpage div#toc { display: none; }
539 </style>
540 <script type="text/javascript">
541 /*<![CDATA[*/
542 var asciidoc = { // Namespace.
544 /////////////////////////////////////////////////////////////////////
545 // Table Of Contents generator
546 /////////////////////////////////////////////////////////////////////
548 /* Author: Mihai Bazon, September 2002
549 * http://students.infoiasi.ro/~mishoo
551 * Table Of Content generator
552 * Version: 0.4
554 * Feel free to use this script under the terms of the GNU General Public
555 * License, as long as you do not remove or alter this notice.
558 /* modified by Troy D. Hanson, September 2006. License: GPL */
559 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
561 // toclevels = 1..4.
562 toc: function (toclevels) {
564 function getText(el) {
565 var text = "";
566 for (var i = el.firstChild; i != null; i = i.nextSibling) {
567 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
568 text += i.data;
569 else if (i.firstChild != null)
570 text += getText(i);
572 return text;
575 function TocEntry(el, text, toclevel) {
576 this.element = el;
577 this.text = text;
578 this.toclevel = toclevel;
581 function tocEntries(el, toclevels) {
582 var result = new Array;
583 var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
584 // Function that scans the DOM tree for header elements (the DOM2
585 // nodeIterator API would be a better technique but not supported by all
586 // browsers).
587 var iterate = function (el) {
588 for (var i = el.firstChild; i != null; i = i.nextSibling) {
589 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
590 var mo = re.exec(i.tagName);
591 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
592 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
594 iterate(i);
598 iterate(el);
599 return result;
602 var toc = document.getElementById("toc");
603 if (!toc) {
604 return;
607 // Delete existing TOC entries in case we're reloading the TOC.
608 var tocEntriesToRemove = [];
609 var i;
610 for (i = 0; i < toc.childNodes.length; i++) {
611 var entry = toc.childNodes[i];
612 if (entry.nodeName.toLowerCase() == 'div'
613 && entry.getAttribute("class")
614 && entry.getAttribute("class").match(/^toclevel/))
615 tocEntriesToRemove.push(entry);
617 for (i = 0; i < tocEntriesToRemove.length; i++) {
618 toc.removeChild(tocEntriesToRemove[i]);
621 // Rebuild TOC entries.
622 var entries = tocEntries(document.getElementById("content"), toclevels);
623 for (var i = 0; i < entries.length; ++i) {
624 var entry = entries[i];
625 if (entry.element.id == "")
626 entry.element.id = "_toc_" + i;
627 var a = document.createElement("a");
628 a.href = "#" + entry.element.id;
629 a.appendChild(document.createTextNode(entry.text));
630 var div = document.createElement("div");
631 div.appendChild(a);
632 div.className = "toclevel" + entry.toclevel;
633 toc.appendChild(div);
635 if (entries.length == 0)
636 toc.parentNode.removeChild(toc);
640 /////////////////////////////////////////////////////////////////////
641 // Footnotes generator
642 /////////////////////////////////////////////////////////////////////
644 /* Based on footnote generation code from:
645 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
648 footnotes: function () {
649 // Delete existing footnote entries in case we're reloading the footnodes.
650 var i;
651 var noteholder = document.getElementById("footnotes");
652 if (!noteholder) {
653 return;
655 var entriesToRemove = [];
656 for (i = 0; i < noteholder.childNodes.length; i++) {
657 var entry = noteholder.childNodes[i];
658 if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
659 entriesToRemove.push(entry);
661 for (i = 0; i < entriesToRemove.length; i++) {
662 noteholder.removeChild(entriesToRemove[i]);
665 // Rebuild footnote entries.
666 var cont = document.getElementById("content");
667 var spans = cont.getElementsByTagName("span");
668 var refs = {};
669 var n = 0;
670 for (i=0; i<spans.length; i++) {
671 if (spans[i].className == "footnote") {
672 n++;
673 var note = spans[i].getAttribute("data-note");
674 if (!note) {
675 // Use [\s\S] in place of . so multi-line matches work.
676 // Because JavaScript has no s (dotall) regex flag.
677 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
678 spans[i].innerHTML =
679 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
680 "' title='View footnote' class='footnote'>" + n + "</a>]";
681 spans[i].setAttribute("data-note", note);
683 noteholder.innerHTML +=
684 "<div class='footnote' id='_footnote_" + n + "'>" +
685 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
686 n + "</a>. " + note + "</div>";
687 var id =spans[i].getAttribute("id");
688 if (id != null) refs["#"+id] = n;
691 if (n == 0)
692 noteholder.parentNode.removeChild(noteholder);
693 else {
694 // Process footnoterefs.
695 for (i=0; i<spans.length; i++) {
696 if (spans[i].className == "footnoteref") {
697 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
698 href = href.match(/#.*/)[0]; // Because IE return full URL.
699 n = refs[href];
700 spans[i].innerHTML =
701 "[<a href='#_footnote_" + n +
702 "' title='View footnote' class='footnote'>" + n + "</a>]";
708 install: function(toclevels) {
709 var timerId;
711 function reinstall() {
712 asciidoc.footnotes();
713 if (toclevels) {
714 asciidoc.toc(toclevels);
718 function reinstallAndRemoveTimer() {
719 clearInterval(timerId);
720 reinstall();
723 timerId = setInterval(reinstall, 500);
724 if (document.addEventListener)
725 document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
726 else
727 window.onload = reinstallAndRemoveTimer;
731 asciidoc.install();
732 /*]]>*/
733 </script>
734 </head>
735 <body class="manpage">
736 <div id="header">
737 <h1>
738 git-commit(1) Manual Page
739 </h1>
740 <h2>NAME</h2>
741 <div class="sectionbody">
742 <p>git-commit -
743 Record changes to the repository
744 </p>
745 </div>
746 </div>
747 <div id="content">
748 <div class="sect1">
749 <h2 id="_synopsis">SYNOPSIS</h2>
750 <div class="sectionbody">
751 <div class="verseblock">
752 <pre class="content"><em>git commit</em> [-a | --interactive | --patch] [-s] [-v] [-u&lt;mode&gt;] [--amend]
753 [--dry-run] [(-c | -C | --squash) &lt;commit&gt; | --fixup [(amend|reword):]&lt;commit&gt;)]
754 [-F &lt;file&gt; | -m &lt;msg&gt;] [--reset-author] [--allow-empty]
755 [--allow-empty-message] [--no-verify] [-e] [--author=&lt;author&gt;]
756 [--date=&lt;date&gt;] [--cleanup=&lt;mode&gt;] [--[no-]status]
757 [-i | -o] [--pathspec-from-file=&lt;file&gt; [--pathspec-file-nul]]
758 [(--trailer &lt;token&gt;[(=|:)&lt;value&gt;])&#8230;] [-S[&lt;keyid&gt;]]
759 [--] [&lt;pathspec&gt;&#8230;]</pre>
760 <div class="attribution">
761 </div></div>
762 </div>
763 </div>
764 <div class="sect1">
765 <h2 id="_description">DESCRIPTION</h2>
766 <div class="sectionbody">
767 <div class="paragraph"><p>Create a new commit containing the current contents of the index and
768 the given log message describing the changes. The new commit is a
769 direct child of HEAD, usually the tip of the current branch, and the
770 branch is updated to point to it (unless no branch is associated with
771 the working tree, in which case HEAD is "detached" as described in
772 <a href="git-checkout.html">git-checkout(1)</a>).</p></div>
773 <div class="paragraph"><p>The content to be committed can be specified in several ways:</p></div>
774 <div class="olist arabic"><ol class="arabic">
775 <li>
777 by using <a href="git-add.html">git-add(1)</a> to incrementally "add" changes to the
778 index before using the <em>commit</em> command (Note: even modified files
779 must be "added");
780 </p>
781 </li>
782 <li>
784 by using <a href="git-rm.html">git-rm(1)</a> to remove files from the working tree
785 and the index, again before using the <em>commit</em> command;
786 </p>
787 </li>
788 <li>
790 by listing files as arguments to the <em>commit</em> command
791 (without --interactive or --patch switch), in which
792 case the commit will ignore changes staged in the index, and instead
793 record the current content of the listed files (which must already
794 be known to Git);
795 </p>
796 </li>
797 <li>
799 by using the -a switch with the <em>commit</em> command to automatically
800 "add" changes from all known files (i.e. all files that are already
801 listed in the index) and to automatically "rm" files in the index
802 that have been removed from the working tree, and then perform the
803 actual commit;
804 </p>
805 </li>
806 <li>
808 by using the --interactive or --patch switches with the <em>commit</em> command
809 to decide one by one which files or hunks should be part of the commit
810 in addition to contents in the index,
811 before finalizing the operation. See the &#8220;Interactive Mode&#8221; section of
812 <a href="git-add.html">git-add(1)</a> to learn how to operate these modes.
813 </p>
814 </li>
815 </ol></div>
816 <div class="paragraph"><p>The <code>--dry-run</code> option can be used to obtain a
817 summary of what is included by any of the above for the next
818 commit by giving the same set of parameters (options and paths).</p></div>
819 <div class="paragraph"><p>If you make a commit and then find a mistake immediately after
820 that, you can recover from it with <em>git reset</em>.</p></div>
821 </div>
822 </div>
823 <div class="sect1">
824 <h2 id="_options">OPTIONS</h2>
825 <div class="sectionbody">
826 <div class="dlist"><dl>
827 <dt class="hdlist1">
829 </dt>
830 <dt class="hdlist1">
831 --all
832 </dt>
833 <dd>
835 Tell the command to automatically stage files that have
836 been modified and deleted, but new files you have not
837 told Git about are not affected.
838 </p>
839 </dd>
840 <dt class="hdlist1">
842 </dt>
843 <dt class="hdlist1">
844 --patch
845 </dt>
846 <dd>
848 Use the interactive patch selection interface to choose
849 which changes to commit. See <a href="git-add.html">git-add(1)</a> for
850 details.
851 </p>
852 </dd>
853 <dt class="hdlist1">
854 -C &lt;commit&gt;
855 </dt>
856 <dt class="hdlist1">
857 --reuse-message=&lt;commit&gt;
858 </dt>
859 <dd>
861 Take an existing commit object, and reuse the log message
862 and the authorship information (including the timestamp)
863 when creating the commit.
864 </p>
865 </dd>
866 <dt class="hdlist1">
867 -c &lt;commit&gt;
868 </dt>
869 <dt class="hdlist1">
870 --reedit-message=&lt;commit&gt;
871 </dt>
872 <dd>
874 Like <em>-C</em>, but with <code>-c</code> the editor is invoked, so that
875 the user can further edit the commit message.
876 </p>
877 </dd>
878 <dt class="hdlist1">
879 --fixup=[(amend|reword):]&lt;commit&gt;
880 </dt>
881 <dd>
883 Create a new commit which "fixes up" <code>&lt;commit&gt;</code> when applied with
884 <code>git rebase --autosquash</code>. Plain <code>--fixup=&lt;commit&gt;</code> creates a
885 "fixup!" commit which changes the content of <code>&lt;commit&gt;</code> but leaves
886 its log message untouched. <code>--fixup=amend:&lt;commit&gt;</code> is similar but
887 creates an "amend!" commit which also replaces the log message of
888 <code>&lt;commit&gt;</code> with the log message of the "amend!" commit.
889 <code>--fixup=reword:&lt;commit&gt;</code> creates an "amend!" commit which
890 replaces the log message of <code>&lt;commit&gt;</code> with its own log message
891 but makes no changes to the content of <code>&lt;commit&gt;</code>.
892 </p>
893 <div class="paragraph"><p>The commit created by plain <code>--fixup=&lt;commit&gt;</code> has a subject
894 composed of "fixup!" followed by the subject line from &lt;commit&gt;,
895 and is recognized specially by <code>git rebase --autosquash</code>. The <code>-m</code>
896 option may be used to supplement the log message of the created
897 commit, but the additional commentary will be thrown away once the
898 "fixup!" commit is squashed into <code>&lt;commit&gt;</code> by
899 <code>git rebase --autosquash</code>.</p></div>
900 <div class="paragraph"><p>The commit created by <code>--fixup=amend:&lt;commit&gt;</code> is similar but its
901 subject is instead prefixed with "amend!". The log message of
902 &lt;commit&gt; is copied into the log message of the "amend!" commit and
903 opened in an editor so it can be refined. When <code>git rebase
904 --autosquash</code> squashes the "amend!" commit into <code>&lt;commit&gt;</code>, the
905 log message of <code>&lt;commit&gt;</code> is replaced by the refined log message
906 from the "amend!" commit. It is an error for the "amend!" commit&#8217;s
907 log message to be empty unless <code>--allow-empty-message</code> is
908 specified.</p></div>
909 <div class="paragraph"><p><code>--fixup=reword:&lt;commit&gt;</code> is shorthand for <code>--fixup=amend:&lt;commit&gt;
910 --only</code>. It creates an "amend!" commit with only a log message
911 (ignoring any changes staged in the index). When squashed by <code>git
912 rebase --autosquash</code>, it replaces the log message of <code>&lt;commit&gt;</code>
913 without making any other changes.</p></div>
914 <div class="paragraph"><p>Neither "fixup!" nor "amend!" commits change authorship of
915 <code>&lt;commit&gt;</code> when applied by <code>git rebase --autosquash</code>.
916 See <a href="git-rebase.html">git-rebase(1)</a> for details.</p></div>
917 </dd>
918 <dt class="hdlist1">
919 --squash=&lt;commit&gt;
920 </dt>
921 <dd>
923 Construct a commit message for use with <code>rebase --autosquash</code>.
924 The commit message subject line is taken from the specified
925 commit with a prefix of "squash! ". Can be used with additional
926 commit message options (<code>-m</code>/<code>-c</code>/<code>-C</code>/<code>-F</code>). See
927 <a href="git-rebase.html">git-rebase(1)</a> for details.
928 </p>
929 </dd>
930 <dt class="hdlist1">
931 --reset-author
932 </dt>
933 <dd>
935 When used with -C/-c/--amend options, or when committing after a
936 conflicting cherry-pick, declare that the authorship of the
937 resulting commit now belongs to the committer. This also renews
938 the author timestamp.
939 </p>
940 </dd>
941 <dt class="hdlist1">
942 --short
943 </dt>
944 <dd>
946 When doing a dry-run, give the output in the short-format. See
947 <a href="git-status.html">git-status(1)</a> for details. Implies <code>--dry-run</code>.
948 </p>
949 </dd>
950 <dt class="hdlist1">
951 --branch
952 </dt>
953 <dd>
955 Show the branch and tracking info even in short-format.
956 </p>
957 </dd>
958 <dt class="hdlist1">
959 --porcelain
960 </dt>
961 <dd>
963 When doing a dry-run, give the output in a porcelain-ready
964 format. See <a href="git-status.html">git-status(1)</a> for details. Implies
965 <code>--dry-run</code>.
966 </p>
967 </dd>
968 <dt class="hdlist1">
969 --long
970 </dt>
971 <dd>
973 When doing a dry-run, give the output in the long-format.
974 Implies <code>--dry-run</code>.
975 </p>
976 </dd>
977 <dt class="hdlist1">
979 </dt>
980 <dt class="hdlist1">
981 --null
982 </dt>
983 <dd>
985 When showing <code>short</code> or <code>porcelain</code> status output, print the
986 filename verbatim and terminate the entries with NUL, instead of LF.
987 If no format is given, implies the <code>--porcelain</code> output format.
988 Without the <code>-z</code> option, filenames with "unusual" characters are
989 quoted as explained for the configuration variable <code>core.quotePath</code>
990 (see <a href="git-config.html">git-config(1)</a>).
991 </p>
992 </dd>
993 <dt class="hdlist1">
994 -F &lt;file&gt;
995 </dt>
996 <dt class="hdlist1">
997 --file=&lt;file&gt;
998 </dt>
999 <dd>
1001 Take the commit message from the given file. Use <em>-</em> to
1002 read the message from the standard input.
1003 </p>
1004 </dd>
1005 <dt class="hdlist1">
1006 --author=&lt;author&gt;
1007 </dt>
1008 <dd>
1010 Override the commit author. Specify an explicit author using the
1011 standard <code>A U Thor &lt;author@example.com&gt;</code> format. Otherwise &lt;author&gt;
1012 is assumed to be a pattern and is used to search for an existing
1013 commit by that author (i.e. rev-list --all -i --author=&lt;author&gt;);
1014 the commit author is then copied from the first such commit found.
1015 </p>
1016 </dd>
1017 <dt class="hdlist1">
1018 --date=&lt;date&gt;
1019 </dt>
1020 <dd>
1022 Override the author date used in the commit.
1023 </p>
1024 </dd>
1025 <dt class="hdlist1">
1026 -m &lt;msg&gt;
1027 </dt>
1028 <dt class="hdlist1">
1029 --message=&lt;msg&gt;
1030 </dt>
1031 <dd>
1033 Use the given &lt;msg&gt; as the commit message.
1034 If multiple <code>-m</code> options are given, their values are
1035 concatenated as separate paragraphs.
1036 </p>
1037 <div class="paragraph"><p>The <code>-m</code> option is mutually exclusive with <code>-c</code>, <code>-C</code>, and <code>-F</code>.</p></div>
1038 </dd>
1039 <dt class="hdlist1">
1040 -t &lt;file&gt;
1041 </dt>
1042 <dt class="hdlist1">
1043 --template=&lt;file&gt;
1044 </dt>
1045 <dd>
1047 When editing the commit message, start the editor with the
1048 contents in the given file. The <code>commit.template</code> configuration
1049 variable is often used to give this option implicitly to the
1050 command. This mechanism can be used by projects that want to
1051 guide participants with some hints on what to write in the message
1052 in what order. If the user exits the editor without editing the
1053 message, the commit is aborted. This has no effect when a message
1054 is given by other means, e.g. with the <code>-m</code> or <code>-F</code> options.
1055 </p>
1056 </dd>
1057 <dt class="hdlist1">
1059 </dt>
1060 <dt class="hdlist1">
1061 --signoff
1062 </dt>
1063 <dt class="hdlist1">
1064 --no-signoff
1065 </dt>
1066 <dd>
1068 Add a <code>Signed-off-by</code> trailer by the committer at the end of the commit
1069 log message. The meaning of a signoff depends on the project
1070 to which you&#8217;re committing. For example, it may certify that
1071 the committer has the rights to submit the work under the
1072 project&#8217;s license or agrees to some contributor representation,
1073 such as a Developer Certificate of Origin.
1074 (See <a href="https://developercertificate.org">https://developercertificate.org</a> for the one used by the
1075 Linux kernel and Git projects.) Consult the documentation or
1076 leadership of the project to which you&#8217;re contributing to
1077 understand how the signoffs are used in that project.
1078 </p>
1079 <div class="paragraph"><p>The --no-signoff option can be used to countermand an earlier --signoff
1080 option on the command line.</p></div>
1081 </dd>
1082 <dt class="hdlist1">
1083 --trailer &lt;token&gt;[(=|:)&lt;value&gt;]
1084 </dt>
1085 <dd>
1087 Specify a (&lt;token&gt;, &lt;value&gt;) pair that should be applied as a
1088 trailer. (e.g. <code>git commit --trailer "Signed-off-by:C O Mitter \
1089 &lt;committer@example.com&gt;" --trailer "Helped-by:C O Mitter \
1090 &lt;committer@example.com&gt;"</code> will add the "Signed-off-by" trailer
1091 and the "Helped-by" trailer to the commit message.)
1092 The <code>trailer.*</code> configuration variables
1093 (<a href="git-interpret-trailers.html">git-interpret-trailers(1)</a>) can be used to define if
1094 a duplicated trailer is omitted, where in the run of trailers
1095 each trailer would appear, and other details.
1096 </p>
1097 </dd>
1098 <dt class="hdlist1">
1100 </dt>
1101 <dt class="hdlist1">
1102 --[no-]verify
1103 </dt>
1104 <dd>
1106 By default, the pre-commit and commit-msg hooks are run.
1107 When any of <code>--no-verify</code> or <code>-n</code> is given, these are bypassed.
1108 See also <a href="githooks.html">githooks(5)</a>.
1109 </p>
1110 </dd>
1111 <dt class="hdlist1">
1112 --allow-empty
1113 </dt>
1114 <dd>
1116 Usually recording a commit that has the exact same tree as its
1117 sole parent commit is a mistake, and the command prevents you
1118 from making such a commit. This option bypasses the safety, and
1119 is primarily for use by foreign SCM interface scripts.
1120 </p>
1121 </dd>
1122 <dt class="hdlist1">
1123 --allow-empty-message
1124 </dt>
1125 <dd>
1127 Like --allow-empty this command is primarily for use by foreign
1128 SCM interface scripts. It allows you to create a commit with an
1129 empty commit message without using plumbing commands like
1130 <a href="git-commit-tree.html">git-commit-tree(1)</a>.
1131 </p>
1132 </dd>
1133 <dt class="hdlist1">
1134 --cleanup=&lt;mode&gt;
1135 </dt>
1136 <dd>
1138 This option determines how the supplied commit message should be
1139 cleaned up before committing. The <em>&lt;mode&gt;</em> can be <code>strip</code>,
1140 <code>whitespace</code>, <code>verbatim</code>, <code>scissors</code> or <code>default</code>.
1141 </p>
1142 <div class="openblock">
1143 <div class="content">
1144 <div class="dlist"><dl>
1145 <dt class="hdlist1">
1146 strip
1147 </dt>
1148 <dd>
1150 Strip leading and trailing empty lines, trailing whitespace,
1151 commentary and collapse consecutive empty lines.
1152 </p>
1153 </dd>
1154 <dt class="hdlist1">
1155 whitespace
1156 </dt>
1157 <dd>
1159 Same as <code>strip</code> except #commentary is not removed.
1160 </p>
1161 </dd>
1162 <dt class="hdlist1">
1163 verbatim
1164 </dt>
1165 <dd>
1167 Do not change the message at all.
1168 </p>
1169 </dd>
1170 <dt class="hdlist1">
1171 scissors
1172 </dt>
1173 <dd>
1175 Same as <code>whitespace</code> except that everything from (and including)
1176 the line found below is truncated, if the message is to be edited.
1177 "<code>#</code>" can be customized with core.commentChar.
1178 </p>
1179 <div class="literalblock">
1180 <div class="content">
1181 <pre><code># ------------------------ &gt;8 ------------------------</code></pre>
1182 </div></div>
1183 </dd>
1184 <dt class="hdlist1">
1185 default
1186 </dt>
1187 <dd>
1189 Same as <code>strip</code> if the message is to be edited.
1190 Otherwise <code>whitespace</code>.
1191 </p>
1192 </dd>
1193 </dl></div>
1194 </div></div>
1195 <div class="paragraph"><p>The default can be changed by the <code>commit.cleanup</code> configuration
1196 variable (see <a href="git-config.html">git-config(1)</a>).</p></div>
1197 </dd>
1198 <dt class="hdlist1">
1200 </dt>
1201 <dt class="hdlist1">
1202 --edit
1203 </dt>
1204 <dd>
1206 The message taken from file with <code>-F</code>, command line with
1207 <code>-m</code>, and from commit object with <code>-C</code> are usually used as
1208 the commit log message unmodified. This option lets you
1209 further edit the message taken from these sources.
1210 </p>
1211 </dd>
1212 <dt class="hdlist1">
1213 --no-edit
1214 </dt>
1215 <dd>
1217 Use the selected commit message without launching an editor.
1218 For example, <code>git commit --amend --no-edit</code> amends a commit
1219 without changing its commit message.
1220 </p>
1221 </dd>
1222 <dt class="hdlist1">
1223 --amend
1224 </dt>
1225 <dd>
1227 Replace the tip of the current branch by creating a new
1228 commit. The recorded tree is prepared as usual (including
1229 the effect of the <code>-i</code> and <code>-o</code> options and explicit
1230 pathspec), and the message from the original commit is used
1231 as the starting point, instead of an empty message, when no
1232 other message is specified from the command line via options
1233 such as <code>-m</code>, <code>-F</code>, <code>-c</code>, etc. The new commit has the same
1234 parents and author as the current one (the <code>--reset-author</code>
1235 option can countermand this).
1236 </p>
1237 <div class="openblock">
1238 <div class="content">
1239 <div class="paragraph"><p>It is a rough equivalent for:</p></div>
1240 <div class="listingblock">
1241 <div class="content">
1242 <pre><code> $ git reset --soft HEAD^
1243 $ ... do something else to come up with the right tree ...
1244 $ git commit -c ORIG_HEAD</code></pre>
1245 </div></div>
1246 <div class="paragraph"><p>but can be used to amend a merge commit.</p></div>
1247 </div></div>
1248 <div class="paragraph"><p>You should understand the implications of rewriting history if you
1249 amend a commit that has already been published. (See the "RECOVERING
1250 FROM UPSTREAM REBASE" section in <a href="git-rebase.html">git-rebase(1)</a>.)</p></div>
1251 </dd>
1252 <dt class="hdlist1">
1253 --no-post-rewrite
1254 </dt>
1255 <dd>
1257 Bypass the post-rewrite hook.
1258 </p>
1259 </dd>
1260 <dt class="hdlist1">
1262 </dt>
1263 <dt class="hdlist1">
1264 --include
1265 </dt>
1266 <dd>
1268 Before making a commit out of staged contents so far,
1269 stage the contents of paths given on the command line
1270 as well. This is usually not what you want unless you
1271 are concluding a conflicted merge.
1272 </p>
1273 </dd>
1274 <dt class="hdlist1">
1276 </dt>
1277 <dt class="hdlist1">
1278 --only
1279 </dt>
1280 <dd>
1282 Make a commit by taking the updated working tree contents
1283 of the paths specified on the
1284 command line, disregarding any contents that have been
1285 staged for other paths. This is the default mode of operation of
1286 <em>git commit</em> if any paths are given on the command line,
1287 in which case this option can be omitted.
1288 If this option is specified together with <code>--amend</code>, then
1289 no paths need to be specified, which can be used to amend
1290 the last commit without committing changes that have
1291 already been staged. If used together with <code>--allow-empty</code>
1292 paths are also not required, and an empty commit will be created.
1293 </p>
1294 </dd>
1295 <dt class="hdlist1">
1296 --pathspec-from-file=&lt;file&gt;
1297 </dt>
1298 <dd>
1300 Pathspec is passed in <code>&lt;file&gt;</code> instead of commandline args. If
1301 <code>&lt;file&gt;</code> is exactly <code>-</code> then standard input is used. Pathspec
1302 elements are separated by LF or CR/LF. Pathspec elements can be
1303 quoted as explained for the configuration variable <code>core.quotePath</code>
1304 (see <a href="git-config.html">git-config(1)</a>). See also <code>--pathspec-file-nul</code> and
1305 global <code>--literal-pathspecs</code>.
1306 </p>
1307 </dd>
1308 <dt class="hdlist1">
1309 --pathspec-file-nul
1310 </dt>
1311 <dd>
1313 Only meaningful with <code>--pathspec-from-file</code>. Pathspec elements are
1314 separated with NUL character and all other characters are taken
1315 literally (including newlines and quotes).
1316 </p>
1317 </dd>
1318 <dt class="hdlist1">
1319 -u[&lt;mode&gt;]
1320 </dt>
1321 <dt class="hdlist1">
1322 --untracked-files[=&lt;mode&gt;]
1323 </dt>
1324 <dd>
1326 Show untracked files.
1327 </p>
1328 <div class="openblock">
1329 <div class="content">
1330 <div class="paragraph"><p>The mode parameter is optional (defaults to <em>all</em>), and is used to
1331 specify the handling of untracked files; when -u is not used, the
1332 default is <em>normal</em>, i.e. show untracked files and directories.</p></div>
1333 <div class="paragraph"><p>The possible options are:</p></div>
1334 <div class="ulist"><ul>
1335 <li>
1337 <em>no</em> - Show no untracked files
1338 </p>
1339 </li>
1340 <li>
1342 <em>normal</em> - Shows untracked files and directories
1343 </p>
1344 </li>
1345 <li>
1347 <em>all</em> - Also shows individual files in untracked directories.
1348 </p>
1349 </li>
1350 </ul></div>
1351 <div class="paragraph"><p>All usual spellings for Boolean value <code>true</code> are taken as <code>normal</code>
1352 and <code>false</code> as <code>no</code>.
1353 The default can be changed using the status.showUntrackedFiles
1354 configuration variable documented in <a href="git-config.html">git-config(1)</a>.</p></div>
1355 </div></div>
1356 </dd>
1357 <dt class="hdlist1">
1359 </dt>
1360 <dt class="hdlist1">
1361 --verbose
1362 </dt>
1363 <dd>
1365 Show unified diff between the HEAD commit and what
1366 would be committed at the bottom of the commit message
1367 template to help the user describe the commit by reminding
1368 what changes the commit has.
1369 Note that this diff output doesn&#8217;t have its
1370 lines prefixed with <em>#</em>. This diff will not be a part
1371 of the commit message. See the <code>commit.verbose</code> configuration
1372 variable in <a href="git-config.html">git-config(1)</a>.
1373 </p>
1374 <div class="paragraph"><p>If specified twice, show in addition the unified diff between
1375 what would be committed and the worktree files, i.e. the unstaged
1376 changes to tracked files.</p></div>
1377 </dd>
1378 <dt class="hdlist1">
1380 </dt>
1381 <dt class="hdlist1">
1382 --quiet
1383 </dt>
1384 <dd>
1386 Suppress commit summary message.
1387 </p>
1388 </dd>
1389 <dt class="hdlist1">
1390 --dry-run
1391 </dt>
1392 <dd>
1394 Do not create a commit, but show a list of paths that are
1395 to be committed, paths with local changes that will be left
1396 uncommitted and paths that are untracked.
1397 </p>
1398 </dd>
1399 <dt class="hdlist1">
1400 --status
1401 </dt>
1402 <dd>
1404 Include the output of <a href="git-status.html">git-status(1)</a> in the commit
1405 message template when using an editor to prepare the commit
1406 message. Defaults to on, but can be used to override
1407 configuration variable commit.status.
1408 </p>
1409 </dd>
1410 <dt class="hdlist1">
1411 --no-status
1412 </dt>
1413 <dd>
1415 Do not include the output of <a href="git-status.html">git-status(1)</a> in the
1416 commit message template when using an editor to prepare the
1417 default commit message.
1418 </p>
1419 </dd>
1420 <dt class="hdlist1">
1421 -S[&lt;keyid&gt;]
1422 </dt>
1423 <dt class="hdlist1">
1424 --gpg-sign[=&lt;keyid&gt;]
1425 </dt>
1426 <dt class="hdlist1">
1427 --no-gpg-sign
1428 </dt>
1429 <dd>
1431 GPG-sign commits. The <code>keyid</code> argument is optional and
1432 defaults to the committer identity; if specified, it must be
1433 stuck to the option without a space. <code>--no-gpg-sign</code> is useful to
1434 countermand both <code>commit.gpgSign</code> configuration variable, and
1435 earlier <code>--gpg-sign</code>.
1436 </p>
1437 </dd>
1438 <dt class="hdlist1">
1440 </dt>
1441 <dd>
1443 Do not interpret any more arguments as options.
1444 </p>
1445 </dd>
1446 <dt class="hdlist1">
1447 &lt;pathspec&gt;&#8230;
1448 </dt>
1449 <dd>
1451 When pathspec is given on the command line, commit the contents of
1452 the files that match the pathspec without recording the changes
1453 already added to the index. The contents of these files are also
1454 staged for the next commit on top of what have been staged before.
1455 </p>
1456 <div class="paragraph"><p>For more details, see the <em>pathspec</em> entry in <a href="gitglossary.html">gitglossary(7)</a>.</p></div>
1457 </dd>
1458 </dl></div>
1459 </div>
1460 </div>
1461 <div class="sect1">
1462 <h2 id="_examples">EXAMPLES</h2>
1463 <div class="sectionbody">
1464 <div class="paragraph"><p>When recording your own work, the contents of modified files in
1465 your working tree are temporarily stored to a staging area
1466 called the "index" with <em>git add</em>. A file can be
1467 reverted back, only in the index but not in the working tree,
1468 to that of the last commit with <code>git restore --staged &lt;file&gt;</code>,
1469 which effectively reverts <em>git add</em> and prevents the changes to
1470 this file from participating in the next commit. After building
1471 the state to be committed incrementally with these commands,
1472 <code>git commit</code> (without any pathname parameter) is used to record what
1473 has been staged so far. This is the most basic form of the
1474 command. An example:</p></div>
1475 <div class="listingblock">
1476 <div class="content">
1477 <pre><code>$ edit hello.c
1478 $ git rm goodbye.c
1479 $ git add hello.c
1480 $ git commit</code></pre>
1481 </div></div>
1482 <div class="paragraph"><p>Instead of staging files after each individual change, you can
1483 tell <code>git commit</code> to notice the changes to the files whose
1484 contents are tracked in
1485 your working tree and do corresponding <code>git add</code> and <code>git rm</code>
1486 for you. That is, this example does the same as the earlier
1487 example if there is no other change in your working tree:</p></div>
1488 <div class="listingblock">
1489 <div class="content">
1490 <pre><code>$ edit hello.c
1491 $ rm goodbye.c
1492 $ git commit -a</code></pre>
1493 </div></div>
1494 <div class="paragraph"><p>The command <code>git commit -a</code> first looks at your working tree,
1495 notices that you have modified hello.c and removed goodbye.c,
1496 and performs necessary <code>git add</code> and <code>git rm</code> for you.</p></div>
1497 <div class="paragraph"><p>After staging changes to many files, you can alter the order the
1498 changes are recorded in, by giving pathnames to <code>git commit</code>.
1499 When pathnames are given, the command makes a commit that
1500 only records the changes made to the named paths:</p></div>
1501 <div class="listingblock">
1502 <div class="content">
1503 <pre><code>$ edit hello.c hello.h
1504 $ git add hello.c hello.h
1505 $ edit Makefile
1506 $ git commit Makefile</code></pre>
1507 </div></div>
1508 <div class="paragraph"><p>This makes a commit that records the modification to <code>Makefile</code>.
1509 The changes staged for <code>hello.c</code> and <code>hello.h</code> are not included
1510 in the resulting commit. However, their changes are not lost&#8201;&#8212;&#8201;they are still staged and merely held back. After the above
1511 sequence, if you do:</p></div>
1512 <div class="listingblock">
1513 <div class="content">
1514 <pre><code>$ git commit</code></pre>
1515 </div></div>
1516 <div class="paragraph"><p>this second commit would record the changes to <code>hello.c</code> and
1517 <code>hello.h</code> as expected.</p></div>
1518 <div class="paragraph"><p>After a merge (initiated by <em>git merge</em> or <em>git pull</em>) stops
1519 because of conflicts, cleanly merged
1520 paths are already staged to be committed for you, and paths that
1521 conflicted are left in unmerged state. You would have to first
1522 check which paths are conflicting with <em>git status</em>
1523 and after fixing them manually in your working tree, you would
1524 stage the result as usual with <em>git add</em>:</p></div>
1525 <div class="listingblock">
1526 <div class="content">
1527 <pre><code>$ git status | grep unmerged
1528 unmerged: hello.c
1529 $ edit hello.c
1530 $ git add hello.c</code></pre>
1531 </div></div>
1532 <div class="paragraph"><p>After resolving conflicts and staging the result, <code>git ls-files -u</code>
1533 would stop mentioning the conflicted path. When you are done,
1534 run <code>git commit</code> to finally record the merge:</p></div>
1535 <div class="listingblock">
1536 <div class="content">
1537 <pre><code>$ git commit</code></pre>
1538 </div></div>
1539 <div class="paragraph"><p>As with the case to record your own changes, you can use <code>-a</code>
1540 option to save typing. One difference is that during a merge
1541 resolution, you cannot use <code>git commit</code> with pathnames to
1542 alter the order the changes are committed, because the merge
1543 should be recorded as a single commit. In fact, the command
1544 refuses to run when given pathnames (but see <code>-i</code> option).</p></div>
1545 </div>
1546 </div>
1547 <div class="sect1">
1548 <h2 id="_commit_information">COMMIT INFORMATION</h2>
1549 <div class="sectionbody">
1550 <div class="paragraph"><p>Author and committer information is taken from the following environment
1551 variables, if set:</p></div>
1552 <div class="literalblock">
1553 <div class="content">
1554 <pre><code>GIT_AUTHOR_NAME
1555 GIT_AUTHOR_EMAIL
1556 GIT_AUTHOR_DATE
1557 GIT_COMMITTER_NAME
1558 GIT_COMMITTER_EMAIL
1559 GIT_COMMITTER_DATE</code></pre>
1560 </div></div>
1561 <div class="paragraph"><p>(nb "&lt;", "&gt;" and "\n"s are stripped)</p></div>
1562 <div class="paragraph"><p>The author and committer names are by convention some form of a personal name
1563 (that is, the name by which other humans refer to you), although Git does not
1564 enforce or require any particular form. Arbitrary Unicode may be used, subject
1565 to the constraints listed above. This name has no effect on authentication; for
1566 that, see the <code>credential.username</code> variable in <a href="git-config.html">git-config(1)</a>.</p></div>
1567 <div class="paragraph"><p>In case (some of) these environment variables are not set, the information
1568 is taken from the configuration items <code>user.name</code> and <code>user.email</code>, or, if not
1569 present, the environment variable EMAIL, or, if that is not set,
1570 system user name and the hostname used for outgoing mail (taken
1571 from <code>/etc/mailname</code> and falling back to the fully qualified hostname when
1572 that file does not exist).</p></div>
1573 <div class="paragraph"><p>The <code>author.name</code> and <code>committer.name</code> and their corresponding email options
1574 override <code>user.name</code> and <code>user.email</code> if set and are overridden themselves by
1575 the environment variables.</p></div>
1576 <div class="paragraph"><p>The typical usage is to set just the <code>user.name</code> and <code>user.email</code> variables;
1577 the other options are provided for more complex use cases.</p></div>
1578 </div>
1579 </div>
1580 <div class="sect1">
1581 <h2 id="_date_formats">DATE FORMATS</h2>
1582 <div class="sectionbody">
1583 <div class="paragraph"><p>The <code>GIT_AUTHOR_DATE</code> and <code>GIT_COMMITTER_DATE</code> environment variables
1584 support the following date formats:</p></div>
1585 <div class="dlist"><dl>
1586 <dt class="hdlist1">
1587 Git internal format
1588 </dt>
1589 <dd>
1591 It is <code>&lt;unix-timestamp&gt; &lt;time-zone-offset&gt;</code>, where
1592 <code>&lt;unix-timestamp&gt;</code> is the number of seconds since the UNIX epoch.
1593 <code>&lt;time-zone-offset&gt;</code> is a positive or negative offset from UTC.
1594 For example CET (which is 1 hour ahead of UTC) is <code>+0100</code>.
1595 </p>
1596 </dd>
1597 <dt class="hdlist1">
1598 RFC 2822
1599 </dt>
1600 <dd>
1602 The standard date format as described by RFC 2822, for example
1603 <code>Thu, 07 Apr 2005 22:13:13 +0200</code>.
1604 </p>
1605 </dd>
1606 <dt class="hdlist1">
1607 ISO 8601
1608 </dt>
1609 <dd>
1611 Time and date specified by the ISO 8601 standard, for example
1612 <code>2005-04-07T22:13:13</code>. The parser accepts a space instead of the
1613 <code>T</code> character as well. Fractional parts of a second will be ignored,
1614 for example <code>2005-04-07T22:13:13.019</code> will be treated as
1615 <code>2005-04-07T22:13:13</code>.
1616 </p>
1617 <div class="admonitionblock">
1618 <table><tr>
1619 <td class="icon">
1620 <div class="title">Note</div>
1621 </td>
1622 <td class="content">In addition, the date part is accepted in the following formats:
1623 <code>YYYY.MM.DD</code>, <code>MM/DD/YYYY</code> and <code>DD.MM.YYYY</code>.</td>
1624 </tr></table>
1625 </div>
1626 </dd>
1627 </dl></div>
1628 <div class="paragraph"><p>In addition to recognizing all date formats above, the <code>--date</code> option
1629 will also try to make sense of other, more human-centric date formats,
1630 such as relative dates like "yesterday" or "last Friday at noon".</p></div>
1631 </div>
1632 </div>
1633 <div class="sect1">
1634 <h2 id="_discussion">DISCUSSION</h2>
1635 <div class="sectionbody">
1636 <div class="paragraph"><p>Though not required, it&#8217;s a good idea to begin the commit message
1637 with a single short (no more than 50 characters) line summarizing the
1638 change, followed by a blank line and then a more thorough description.
1639 The text up to the first blank line in a commit message is treated
1640 as the commit title, and that title is used throughout Git.
1641 For example, <a href="git-format-patch.html">git-format-patch(1)</a> turns a commit into email, and it uses
1642 the title on the Subject line and the rest of the commit in the body.</p></div>
1643 <div class="paragraph"><p>Git is to some extent character encoding agnostic.</p></div>
1644 <div class="ulist"><ul>
1645 <li>
1647 The contents of the blob objects are uninterpreted sequences
1648 of bytes. There is no encoding translation at the core
1649 level.
1650 </p>
1651 </li>
1652 <li>
1654 Path names are encoded in UTF-8 normalization form C. This
1655 applies to tree objects, the index file, ref names, as well as
1656 path names in command line arguments, environment variables
1657 and config files (<code>.git/config</code> (see <a href="git-config.html">git-config(1)</a>),
1658 <a href="gitignore.html">gitignore(5)</a>, <a href="gitattributes.html">gitattributes(5)</a> and
1659 <a href="gitmodules.html">gitmodules(5)</a>).
1660 </p>
1661 <div class="paragraph"><p>Note that Git at the core level treats path names simply as
1662 sequences of non-NUL bytes, there are no path name encoding
1663 conversions (except on Mac and Windows). Therefore, using
1664 non-ASCII path names will mostly work even on platforms and file
1665 systems that use legacy extended ASCII encodings. However,
1666 repositories created on such systems will not work properly on
1667 UTF-8-based systems (e.g. Linux, Mac, Windows) and vice versa.
1668 Additionally, many Git-based tools simply assume path names to
1669 be UTF-8 and will fail to display other encodings correctly.</p></div>
1670 </li>
1671 <li>
1673 Commit log messages are typically encoded in UTF-8, but other
1674 extended ASCII encodings are also supported. This includes
1675 ISO-8859-x, CP125x and many others, but <em>not</em> UTF-16/32,
1676 EBCDIC and CJK multi-byte encodings (GBK, Shift-JIS, Big5,
1677 EUC-x, CP9xx etc.).
1678 </p>
1679 </li>
1680 </ul></div>
1681 <div class="paragraph"><p>Although we encourage that the commit log messages are encoded
1682 in UTF-8, both the core and Git Porcelain are designed not to
1683 force UTF-8 on projects. If all participants of a particular
1684 project find it more convenient to use legacy encodings, Git
1685 does not forbid it. However, there are a few things to keep in
1686 mind.</p></div>
1687 <div class="olist arabic"><ol class="arabic">
1688 <li>
1690 <em>git commit</em> and <em>git commit-tree</em> issue
1691 a warning if the commit log message given to it does not look
1692 like a valid UTF-8 string, unless you explicitly say your
1693 project uses a legacy encoding. The way to say this is to
1694 have <code>i18n.commitEncoding</code> in <code>.git/config</code> file, like this:
1695 </p>
1696 <div class="listingblock">
1697 <div class="content">
1698 <pre><code>[i18n]
1699 commitEncoding = ISO-8859-1</code></pre>
1700 </div></div>
1701 <div class="paragraph"><p>Commit objects created with the above setting record the value
1702 of <code>i18n.commitEncoding</code> in their <code>encoding</code> header. This is to
1703 help other people who look at them later. Lack of this header
1704 implies that the commit log message is encoded in UTF-8.</p></div>
1705 </li>
1706 <li>
1708 <em>git log</em>, <em>git show</em>, <em>git blame</em> and friends look at the
1709 <code>encoding</code> header of a commit object, and try to re-code the
1710 log message into UTF-8 unless otherwise specified. You can
1711 specify the desired output encoding with
1712 <code>i18n.logOutputEncoding</code> in <code>.git/config</code> file, like this:
1713 </p>
1714 <div class="listingblock">
1715 <div class="content">
1716 <pre><code>[i18n]
1717 logOutputEncoding = ISO-8859-1</code></pre>
1718 </div></div>
1719 <div class="paragraph"><p>If you do not have this configuration variable, the value of
1720 <code>i18n.commitEncoding</code> is used instead.</p></div>
1721 </li>
1722 </ol></div>
1723 <div class="paragraph"><p>Note that we deliberately chose not to re-code the commit log
1724 message when a commit is made to force UTF-8 at the commit
1725 object level, because re-coding to UTF-8 is not necessarily a
1726 reversible operation.</p></div>
1727 </div>
1728 </div>
1729 <div class="sect1">
1730 <h2 id="_environment_and_configuration_variables">ENVIRONMENT AND CONFIGURATION VARIABLES</h2>
1731 <div class="sectionbody">
1732 <div class="paragraph"><p>The editor used to edit the commit log message will be chosen from the
1733 <code>GIT_EDITOR</code> environment variable, the core.editor configuration variable, the
1734 <code>VISUAL</code> environment variable, or the <code>EDITOR</code> environment variable (in that
1735 order). See <a href="git-var.html">git-var(1)</a> for details.</p></div>
1736 <div class="paragraph"><p>Everything above this line in this section isn&#8217;t included from the
1737 <a href="git-config.html">git-config(1)</a> documentation. The content that follows is the
1738 same as what&#8217;s found there:</p></div>
1739 <div class="dlist"><dl>
1740 <dt class="hdlist1">
1741 commit.cleanup
1742 </dt>
1743 <dd>
1745 This setting overrides the default of the <code>--cleanup</code> option in
1746 <code>git commit</code>. See <a href="git-commit.html">git-commit(1)</a> for details. Changing the
1747 default can be useful when you always want to keep lines that begin
1748 with the comment character <code>#</code> in your log message, in which case you
1749 would do <code>git config commit.cleanup whitespace</code> (note that you will
1750 have to remove the help lines that begin with <code>#</code> in the commit log
1751 template yourself, if you do this).
1752 </p>
1753 </dd>
1754 <dt class="hdlist1">
1755 commit.gpgSign
1756 </dt>
1757 <dd>
1759 A boolean to specify whether all commits should be GPG signed.
1760 Use of this option when doing operations such as rebase can
1761 result in a large number of commits being signed. It may be
1762 convenient to use an agent to avoid typing your GPG passphrase
1763 several times.
1764 </p>
1765 </dd>
1766 <dt class="hdlist1">
1767 commit.status
1768 </dt>
1769 <dd>
1771 A boolean to enable/disable inclusion of status information in the
1772 commit message template when using an editor to prepare the commit
1773 message. Defaults to true.
1774 </p>
1775 </dd>
1776 <dt class="hdlist1">
1777 commit.template
1778 </dt>
1779 <dd>
1781 Specify the pathname of a file to use as the template for
1782 new commit messages.
1783 </p>
1784 </dd>
1785 <dt class="hdlist1">
1786 commit.verbose
1787 </dt>
1788 <dd>
1790 A boolean or int to specify the level of verbosity with <code>git commit</code>.
1791 See <a href="git-commit.html">git-commit(1)</a>.
1792 </p>
1793 </dd>
1794 </dl></div>
1795 </div>
1796 </div>
1797 <div class="sect1">
1798 <h2 id="_hooks">HOOKS</h2>
1799 <div class="sectionbody">
1800 <div class="paragraph"><p>This command can run <code>commit-msg</code>, <code>prepare-commit-msg</code>, <code>pre-commit</code>,
1801 <code>post-commit</code> and <code>post-rewrite</code> hooks. See <a href="githooks.html">githooks(5)</a> for more
1802 information.</p></div>
1803 </div>
1804 </div>
1805 <div class="sect1">
1806 <h2 id="_files">FILES</h2>
1807 <div class="sectionbody">
1808 <div class="dlist"><dl>
1809 <dt class="hdlist1">
1810 <code>$GIT_DIR/COMMIT_EDITMSG</code>
1811 </dt>
1812 <dd>
1814 This file contains the commit message of a commit in progress.
1815 If <code>git commit</code> exits due to an error before creating a commit,
1816 any commit message that has been provided by the user (e.g., in
1817 an editor session) will be available in this file, but will be
1818 overwritten by the next invocation of <code>git commit</code>.
1819 </p>
1820 </dd>
1821 </dl></div>
1822 </div>
1823 </div>
1824 <div class="sect1">
1825 <h2 id="_see_also">SEE ALSO</h2>
1826 <div class="sectionbody">
1827 <div class="paragraph"><p><a href="git-add.html">git-add(1)</a>,
1828 <a href="git-rm.html">git-rm(1)</a>,
1829 <a href="git-mv.html">git-mv(1)</a>,
1830 <a href="git-merge.html">git-merge(1)</a>,
1831 <a href="git-commit-tree.html">git-commit-tree(1)</a></p></div>
1832 </div>
1833 </div>
1834 <div class="sect1">
1835 <h2 id="_git">GIT</h2>
1836 <div class="sectionbody">
1837 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
1838 </div>
1839 </div>
1840 </div>
1841 <div id="footnotes"><hr /></div>
1842 <div id="footer">
1843 <div id="footer-text">
1844 Last updated
1845 2024-03-28 14:36:08 PDT
1846 </div>
1847 </div>
1848 </body>
1849 </html>