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">
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 */
14 font-family: Georgia,serif;
18 h1, h2, h3, h4, h5, h6,
19 div.title, caption.title,
20 thead, p.table.header,
22 #author, #revnumber, #revdate, #revremark,
24 font-family: Arial,Helvetica,sans-serif;
28 margin:
1em
5%
1em
5%;
33 text-decoration: underline;
49 h1, h2, h3, h4, h5, h6 {
57 border-bottom:
2px solid silver;
77 border:
1px solid silver;
88 ul
> li { color: #aaa; }
89 ul
> li
> * { color: black; }
91 .monospaced, code, pre {
92 font-family:
"Courier New", Courier, monospace;
99 white-space: pre-wrap;
109 #revnumber, #revdate, #revremark {
114 border-top:
2px solid silver;
120 padding-bottom:
0.5em;
124 padding-bottom:
0.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 {
135 margin-bottom:
1.5em;
137 div.admonitionblock {
139 margin-bottom:
2.0em;
144 div.content { /* Block element content. */
148 /* Block element titles. */
149 div.title, caption.title {
154 margin-bottom:
0.5em;
160 td div.title:first-child {
163 div.content div.title:first-child {
166 div.content + div.title {
170 div.sidebarblock
> div.content {
172 border:
1px solid #dddddd;
173 border-left:
4px solid #f0f0f0;
177 div.listingblock
> div.content {
178 border:
1px solid #dddddd;
179 border-left:
5px solid #f0f0f0;
184 div.quoteblock, div.verseblock {
188 border-left:
5px solid #f0f0f0;
192 div.quoteblock
> div.attribution {
197 div.verseblock
> pre.content {
198 font-family: inherit;
201 div.verseblock
> div.attribution {
205 /* DEPRECATED: Pre version
8.2.7 verse style literal block. */
206 div.verseblock + div.attribution {
210 div.admonitionblock .icon {
214 text-decoration: underline;
216 padding-right:
0.5em;
218 div.admonitionblock td.content {
220 border-left:
3px solid #dddddd;
223 div.exampleblock
> div.content {
224 border-left:
3px solid #dddddd;
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; }
234 margin-bottom:
0.8em;
247 list-style-position: outside;
250 list-style-type: decimal;
253 list-style-type: lower-alpha;
256 list-style-type: upper-alpha;
259 list-style-type: lower-roman;
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 {
269 margin-bottom:
0.1em;
281 margin-bottom:
0.8em;
284 padding-bottom:
15px;
286 dt.hdlist1.strong, td.hdlist1.strong {
292 padding-right:
0.8em;
298 div.hdlist.compact tr {
307 .footnote, .footnoteref {
311 span.footnote, span.footnoteref {
312 vertical-align: super;
316 margin:
20px
0 20px
0;
320 #footnotes div.footnote {
326 border-top:
1px solid silver;
335 padding-right:
0.5em;
336 padding-bottom:
0.3em;
344 #footer-badges { display: none; }
348 margin-bottom:
2.5em;
356 margin-bottom:
0.1em;
359 div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
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; }
427 margin-bottom:
1.5em;
429 div.tableblock
> table {
430 border:
3px solid #
527bbd;
432 thead, p.table.header {
439 /* Because the table frame attribute is overridden by CSS in most browsers. */
440 div.tableblock
> table[
frame=
"void"] {
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;
460 margin-bottom:
1.5em;
462 thead, p.tableblock.header {
473 border-color: #
527bbd;
474 border-collapse: collapse;
476 th.tableblock, td.tableblock {
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 {
498 th.tableblock.halign-center, td.tableblock.halign-center {
501 th.tableblock.halign-right, td.tableblock.halign-right {
505 th.tableblock.valign-top, td.tableblock.valign-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;
523 padding-bottom:
0.5em;
524 border-top:
2px solid silver;
525 border-bottom:
2px solid silver;
530 body.manpage div.sectionbody {
535 body.manpage div#toc { display: none; }
540 <script type=
"text/javascript">
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
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 */
562 toc: function (toclevels) {
564 function getText(el) {
566 for (var i = el.firstChild; i != null; i = i.nextSibling) {
567 if (i.nodeType ==
3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
569 else if (i.firstChild != null)
575 function TocEntry(el, text, toclevel) {
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
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);
602 var toc = document.getElementById(
"toc");
607 // Delete existing TOC entries in case we're reloading the TOC.
608 var tocEntriesToRemove = [];
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");
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.
651 var noteholder = document.getElementById(
"footnotes");
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");
670 for (i=
0; i
<spans.length; i++) {
671 if (spans[i].className ==
"footnote") {
673 var note = spans[i].getAttribute(
"data-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];
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;
692 noteholder.parentNode.removeChild(noteholder);
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.
701 "[<a href='#_footnote_" + n +
702 "' title='View footnote' class='footnote'>" + n +
"</a>]";
708 install: function(toclevels) {
711 function reinstall() {
712 asciidoc.footnotes();
714 asciidoc.toc(toclevels);
718 function reinstallAndRemoveTimer() {
719 clearInterval(timerId);
723 timerId = setInterval(reinstall,
500);
724 if (document.addEventListener)
725 document.addEventListener(
"DOMContentLoaded", reinstallAndRemoveTimer, false);
727 window.onload = reinstallAndRemoveTimer;
735 <body class=
"manpage">
738 git-commit(
1) Manual Page
741 <div class=
"sectionbody">
743 Record changes to the repository
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
<mode
>] [--amend]
753 [--dry-run] [(-c | -C | --squash)
<commit
> | --fixup [(amend|reword):]
<commit
>)]
754 [-F
<file
> | -m
<msg
>] [--reset-author] [--allow-empty]
755 [--allow-empty-message] [--no-verify] [-e] [--author=
<author
>]
756 [--date=
<date
>] [--cleanup=
<mode
>] [--[no-]status]
757 [-i | -o] [--pathspec-from-file=
<file
> [--pathspec-file-nul]]
758 [(--trailer
<token
>[(=|:)
<value
>])
…] [-S[
<keyid
>]]
759 [--] [
<pathspec
>…]
</pre>
760 <div class=
"attribution">
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">
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
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;
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
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
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
“Interactive Mode
” section of
812 <a href=
"git-add.html">git-add(
1)
</a> to learn how to operate these modes.
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>
824 <h2 id=
"_options">OPTIONS
</h2>
825 <div class=
"sectionbody">
826 <div class=
"dlist"><dl>
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.
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
857 --reuse-message=
<commit
>
861 Take an existing commit object, and reuse the log message
862 and the authorship information (including the timestamp)
863 when creating the commit.
870 --reedit-message=
<commit
>
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.
879 --fixup=[(amend|reword):]
<commit
>
883 Create a new commit which
"fixes up" <code><commit
></code> when applied with
884 <code>git rebase --autosquash
</code>. Plain
<code>--fixup=
<commit
></code> creates a
885 "fixup!" commit which changes the content of
<code><commit
></code> but leaves
886 its log message untouched.
<code>--fixup=amend:
<commit
></code> is similar but
887 creates an
"amend!" commit which also replaces the log message of
888 <code><commit
></code> with the log message of the
"amend!" commit.
889 <code>--fixup=reword:
<commit
></code> creates an
"amend!" commit which
890 replaces the log message of
<code><commit
></code> with its own log message
891 but makes no changes to the content of
<code><commit
></code>.
893 <div class=
"paragraph"><p>The commit created by plain
<code>--fixup=
<commit
></code> has a subject
894 composed of
"fixup!" followed by the subject line from
<commit
>,
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><commit
></code> by
899 <code>git rebase --autosquash
</code>.
</p></div>
900 <div class=
"paragraph"><p>The commit created by
<code>--fixup=amend:
<commit
></code> is similar but its
901 subject is instead prefixed with
"amend!". The log message of
902 <commit
> 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><commit
></code>, the
905 log message of
<code><commit
></code> is replaced by the refined log message
906 from the
"amend!" commit. It is an error for the
"amend!" commit
’s
907 log message to be empty unless
<code>--allow-empty-message
</code> is
909 <div class=
"paragraph"><p><code>--fixup=reword:
<commit
></code> is shorthand for
<code>--fixup=amend:
<commit
>
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><commit
></code>
913 without making any other changes.
</p></div>
914 <div class=
"paragraph"><p>Neither
"fixup!" nor
"amend!" commits change authorship of
915 <code><commit
></code> when applied by
<code>git rebase --autosquash
</code>.
916 See
<a href=
"git-rebase.html">git-rebase(
1)
</a> for details.
</p></div>
919 --squash=
<commit
>
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.
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.
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>.
955 Show the branch and tracking info even in short-format.
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>.
973 When doing a dry-run, give the output in the long-format.
974 Implies
<code>--dry-run
</code>.
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>).
1001 Take the commit message from the given file. Use
<em>-
</em> to
1002 read the message from the standard input.
1005 <dt class=
"hdlist1">
1006 --author=
<author
>
1010 Override the commit author. Specify an explicit author using the
1011 standard
<code>A U Thor
<author@example.com
></code> format. Otherwise
<author
>
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=
<author
>);
1014 the commit author is then copied from the first such commit found.
1017 <dt class=
"hdlist1">
1022 Override the author date used in the commit.
1025 <dt class=
"hdlist1">
1028 <dt class=
"hdlist1">
1029 --message=
<msg
>
1033 Use the given
<msg
> as the commit message.
1034 If multiple
<code>-m
</code> options are given, their values are
1035 concatenated as separate paragraphs.
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>
1039 <dt class=
"hdlist1">
1042 <dt class=
"hdlist1">
1043 --template=
<file
>
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.
1057 <dt class=
"hdlist1">
1060 <dt class=
"hdlist1">
1063 <dt class=
"hdlist1">
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
’re committing. For example, it may certify that
1071 the committer has the rights to submit the work under the
1072 project
’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
’re contributing to
1077 understand how the signoffs are used in that project.
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>
1082 <dt class=
"hdlist1">
1083 --trailer
<token
>[(=|:)
<value
>]
1087 Specify a (
<token
>,
<value
>) pair that should be applied as a
1088 trailer. (e.g.
<code>git commit --trailer
"Signed-off-by:C O Mitter \
1089 <committer@example.com>" --trailer
"Helped-by:C O Mitter \
1090 <committer@example.com>"</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.
1098 <dt class=
"hdlist1">
1101 <dt class=
"hdlist1">
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>.
1111 <dt class=
"hdlist1">
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.
1122 <dt class=
"hdlist1">
1123 --allow-empty-message
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>.
1133 <dt class=
"hdlist1">
1134 --cleanup=
<mode
>
1138 This option determines how the supplied commit message should be
1139 cleaned up before committing. The
<em><mode
></em> can be
<code>strip
</code>,
1140 <code>whitespace
</code>,
<code>verbatim
</code>,
<code>scissors
</code> or
<code>default
</code>.
1142 <div class=
"openblock">
1143 <div class=
"content">
1144 <div class=
"dlist"><dl>
1145 <dt class=
"hdlist1">
1150 Strip leading and trailing empty lines, trailing whitespace,
1151 commentary and collapse consecutive empty lines.
1154 <dt class=
"hdlist1">
1159 Same as
<code>strip
</code> except #commentary is not removed.
1162 <dt class=
"hdlist1">
1167 Do not change the message at all.
1170 <dt class=
"hdlist1">
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.
1179 <div class=
"literalblock">
1180 <div class=
"content">
1181 <pre><code># ------------------------
>8 ------------------------
</code></pre>
1184 <dt class=
"hdlist1">
1189 Same as
<code>strip
</code> if the message is to be edited.
1190 Otherwise
<code>whitespace
</code>.
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>
1198 <dt class=
"hdlist1">
1201 <dt class=
"hdlist1">
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.
1212 <dt class=
"hdlist1">
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.
1222 <dt class=
"hdlist1">
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).
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>
1246 <div class=
"paragraph"><p>but can be used to amend a merge commit.
</p></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>
1252 <dt class=
"hdlist1">
1257 Bypass the post-rewrite hook.
1260 <dt class=
"hdlist1">
1263 <dt class=
"hdlist1">
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.
1274 <dt class=
"hdlist1">
1277 <dt class=
"hdlist1">
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.
1295 <dt class=
"hdlist1">
1296 --pathspec-from-file=
<file
>
1300 Pathspec is passed in
<code><file
></code> instead of commandline args. If
1301 <code><file
></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>.
1308 <dt class=
"hdlist1">
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).
1318 <dt class=
"hdlist1">
1321 <dt class=
"hdlist1">
1322 --untracked-files[=
<mode
>]
1326 Show untracked files.
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>
1337 <em>no
</em> - Show no untracked files
1342 <em>normal
</em> - Shows untracked files and directories
1347 <em>all
</em> - Also shows individual files in untracked directories.
1351 <div class=
"paragraph"><p>The default can be changed using the status.showUntrackedFiles
1352 configuration variable documented in
<a href=
"git-config.html">git-config(
1)
</a>.
</p></div>
1355 <dt class=
"hdlist1">
1358 <dt class=
"hdlist1">
1363 Show unified diff between the HEAD commit and what
1364 would be committed at the bottom of the commit message
1365 template to help the user describe the commit by reminding
1366 what changes the commit has.
1367 Note that this diff output doesn
’t have its
1368 lines prefixed with
<em>#
</em>. This diff will not be a part
1369 of the commit message. See the
<code>commit.verbose
</code> configuration
1370 variable in
<a href=
"git-config.html">git-config(
1)
</a>.
1372 <div class=
"paragraph"><p>If specified twice, show in addition the unified diff between
1373 what would be committed and the worktree files, i.e. the unstaged
1374 changes to tracked files.
</p></div>
1376 <dt class=
"hdlist1">
1379 <dt class=
"hdlist1">
1384 Suppress commit summary message.
1387 <dt class=
"hdlist1">
1392 Do not create a commit, but show a list of paths that are
1393 to be committed, paths with local changes that will be left
1394 uncommitted and paths that are untracked.
1397 <dt class=
"hdlist1">
1402 Include the output of
<a href=
"git-status.html">git-status(
1)
</a> in the commit
1403 message template when using an editor to prepare the commit
1404 message. Defaults to on, but can be used to override
1405 configuration variable commit.status.
1408 <dt class=
"hdlist1">
1413 Do not include the output of
<a href=
"git-status.html">git-status(
1)
</a> in the
1414 commit message template when using an editor to prepare the
1415 default commit message.
1418 <dt class=
"hdlist1">
1421 <dt class=
"hdlist1">
1422 --gpg-sign[=
<keyid
>]
1424 <dt class=
"hdlist1">
1429 GPG-sign commits. The
<code>keyid
</code> argument is optional and
1430 defaults to the committer identity; if specified, it must be
1431 stuck to the option without a space.
<code>--no-gpg-sign
</code> is useful to
1432 countermand both
<code>commit.gpgSign
</code> configuration variable, and
1433 earlier
<code>--gpg-sign
</code>.
1436 <dt class=
"hdlist1">
1441 Do not interpret any more arguments as options.
1444 <dt class=
"hdlist1">
1445 <pathspec
>…
1449 When pathspec is given on the command line, commit the contents of
1450 the files that match the pathspec without recording the changes
1451 already added to the index. The contents of these files are also
1452 staged for the next commit on top of what have been staged before.
1454 <div class=
"paragraph"><p>For more details, see the
<em>pathspec
</em> entry in
<a href=
"gitglossary.html">gitglossary(
7)
</a>.
</p></div>
1460 <h2 id=
"_examples">EXAMPLES
</h2>
1461 <div class=
"sectionbody">
1462 <div class=
"paragraph"><p>When recording your own work, the contents of modified files in
1463 your working tree are temporarily stored to a staging area
1464 called the
"index" with
<em>git add
</em>. A file can be
1465 reverted back, only in the index but not in the working tree,
1466 to that of the last commit with
<code>git restore --staged
<file
></code>,
1467 which effectively reverts
<em>git add
</em> and prevents the changes to
1468 this file from participating in the next commit. After building
1469 the state to be committed incrementally with these commands,
1470 <code>git commit
</code> (without any pathname parameter) is used to record what
1471 has been staged so far. This is the most basic form of the
1472 command. An example:
</p></div>
1473 <div class=
"listingblock">
1474 <div class=
"content">
1475 <pre><code>$ edit hello.c
1478 $ git commit
</code></pre>
1480 <div class=
"paragraph"><p>Instead of staging files after each individual change, you can
1481 tell
<code>git commit
</code> to notice the changes to the files whose
1482 contents are tracked in
1483 your working tree and do corresponding
<code>git add
</code> and
<code>git rm
</code>
1484 for you. That is, this example does the same as the earlier
1485 example if there is no other change in your working tree:
</p></div>
1486 <div class=
"listingblock">
1487 <div class=
"content">
1488 <pre><code>$ edit hello.c
1490 $ git commit -a
</code></pre>
1492 <div class=
"paragraph"><p>The command
<code>git commit -a
</code> first looks at your working tree,
1493 notices that you have modified hello.c and removed goodbye.c,
1494 and performs necessary
<code>git add
</code> and
<code>git rm
</code> for you.
</p></div>
1495 <div class=
"paragraph"><p>After staging changes to many files, you can alter the order the
1496 changes are recorded in, by giving pathnames to
<code>git commit
</code>.
1497 When pathnames are given, the command makes a commit that
1498 only records the changes made to the named paths:
</p></div>
1499 <div class=
"listingblock">
1500 <div class=
"content">
1501 <pre><code>$ edit hello.c hello.h
1502 $ git add hello.c hello.h
1504 $ git commit Makefile
</code></pre>
1506 <div class=
"paragraph"><p>This makes a commit that records the modification to
<code>Makefile
</code>.
1507 The changes staged for
<code>hello.c
</code> and
<code>hello.h
</code> are not included
1508 in the resulting commit. However, their changes are not lost
 — they are still staged and merely held back. After the above
1509 sequence, if you do:
</p></div>
1510 <div class=
"listingblock">
1511 <div class=
"content">
1512 <pre><code>$ git commit
</code></pre>
1514 <div class=
"paragraph"><p>this second commit would record the changes to
<code>hello.c
</code> and
1515 <code>hello.h
</code> as expected.
</p></div>
1516 <div class=
"paragraph"><p>After a merge (initiated by
<em>git merge
</em> or
<em>git pull
</em>) stops
1517 because of conflicts, cleanly merged
1518 paths are already staged to be committed for you, and paths that
1519 conflicted are left in unmerged state. You would have to first
1520 check which paths are conflicting with
<em>git status
</em>
1521 and after fixing them manually in your working tree, you would
1522 stage the result as usual with
<em>git add
</em>:
</p></div>
1523 <div class=
"listingblock">
1524 <div class=
"content">
1525 <pre><code>$ git status | grep unmerged
1528 $ git add hello.c
</code></pre>
1530 <div class=
"paragraph"><p>After resolving conflicts and staging the result,
<code>git ls-files -u
</code>
1531 would stop mentioning the conflicted path. When you are done,
1532 run
<code>git commit
</code> to finally record the merge:
</p></div>
1533 <div class=
"listingblock">
1534 <div class=
"content">
1535 <pre><code>$ git commit
</code></pre>
1537 <div class=
"paragraph"><p>As with the case to record your own changes, you can use
<code>-a
</code>
1538 option to save typing. One difference is that during a merge
1539 resolution, you cannot use
<code>git commit
</code> with pathnames to
1540 alter the order the changes are committed, because the merge
1541 should be recorded as a single commit. In fact, the command
1542 refuses to run when given pathnames (but see
<code>-i
</code> option).
</p></div>
1546 <h2 id=
"_commit_information">COMMIT INFORMATION
</h2>
1547 <div class=
"sectionbody">
1548 <div class=
"paragraph"><p>Author and committer information is taken from the following environment
1549 variables, if set:
</p></div>
1550 <div class=
"literalblock">
1551 <div class=
"content">
1552 <pre><code>GIT_AUTHOR_NAME
1557 GIT_COMMITTER_DATE
</code></pre>
1559 <div class=
"paragraph"><p>(nb
"<",
">" and
"\n"s are stripped)
</p></div>
1560 <div class=
"paragraph"><p>The author and committer names are by convention some form of a personal name
1561 (that is, the name by which other humans refer to you), although Git does not
1562 enforce or require any particular form. Arbitrary Unicode may be used, subject
1563 to the constraints listed above. This name has no effect on authentication; for
1564 that, see the
<code>credential.username
</code> variable in
<a href=
"git-config.html">git-config(
1)
</a>.
</p></div>
1565 <div class=
"paragraph"><p>In case (some of) these environment variables are not set, the information
1566 is taken from the configuration items
<code>user.name
</code> and
<code>user.email
</code>, or, if not
1567 present, the environment variable EMAIL, or, if that is not set,
1568 system user name and the hostname used for outgoing mail (taken
1569 from
<code>/etc/mailname
</code> and falling back to the fully qualified hostname when
1570 that file does not exist).
</p></div>
1571 <div class=
"paragraph"><p>The
<code>author.name
</code> and
<code>committer.name
</code> and their corresponding email options
1572 override
<code>user.name
</code> and
<code>user.email
</code> if set and are overridden themselves by
1573 the environment variables.
</p></div>
1574 <div class=
"paragraph"><p>The typical usage is to set just the
<code>user.name
</code> and
<code>user.email
</code> variables;
1575 the other options are provided for more complex use cases.
</p></div>
1579 <h2 id=
"_date_formats">DATE FORMATS
</h2>
1580 <div class=
"sectionbody">
1581 <div class=
"paragraph"><p>The
<code>GIT_AUTHOR_DATE
</code> and
<code>GIT_COMMITTER_DATE
</code> environment variables
1582 support the following date formats:
</p></div>
1583 <div class=
"dlist"><dl>
1584 <dt class=
"hdlist1">
1589 It is
<code><unix-timestamp
> <time-zone-offset
></code>, where
1590 <code><unix-timestamp
></code> is the number of seconds since the UNIX epoch.
1591 <code><time-zone-offset
></code> is a positive or negative offset from UTC.
1592 For example CET (which is
1 hour ahead of UTC) is
<code>+
0100</code>.
1595 <dt class=
"hdlist1">
1600 The standard email format as described by RFC
2822, for example
1601 <code>Thu,
07 Apr
2005 22:
13:
13 +
0200</code>.
1604 <dt class=
"hdlist1">
1609 Time and date specified by the ISO
8601 standard, for example
1610 <code>2005-
04-
07T22:
13:
13</code>. The parser accepts a space instead of the
1611 <code>T
</code> character as well. Fractional parts of a second will be ignored,
1612 for example
<code>2005-
04-
07T22:
13:
13.019</code> will be treated as
1613 <code>2005-
04-
07T22:
13:
13</code>.
1615 <div class=
"admonitionblock">
1618 <div class=
"title">Note
</div>
1620 <td class=
"content">In addition, the date part is accepted in the following formats:
1621 <code>YYYY.MM.DD
</code>,
<code>MM/DD/YYYY
</code> and
<code>DD.MM.YYYY
</code>.
</td>
1626 <div class=
"paragraph"><p>In addition to recognizing all date formats above, the
<code>--date
</code> option
1627 will also try to make sense of other, more human-centric date formats,
1628 such as relative dates like
"yesterday" or
"last Friday at noon".
</p></div>
1632 <h2 id=
"_discussion">DISCUSSION
</h2>
1633 <div class=
"sectionbody">
1634 <div class=
"paragraph"><p>Though not required, it
’s a good idea to begin the commit message
1635 with a single short (no more than
50 characters) line summarizing the
1636 change, followed by a blank line and then a more thorough description.
1637 The text up to the first blank line in a commit message is treated
1638 as the commit title, and that title is used throughout Git.
1639 For example,
<a href=
"git-format-patch.html">git-format-patch(
1)
</a> turns a commit into email, and it uses
1640 the title on the Subject line and the rest of the commit in the body.
</p></div>
1641 <div class=
"paragraph"><p>Git is to some extent character encoding agnostic.
</p></div>
1642 <div class=
"ulist"><ul>
1645 The contents of the blob objects are uninterpreted sequences
1646 of bytes. There is no encoding translation at the core
1652 Path names are encoded in UTF-
8 normalization form C. This
1653 applies to tree objects, the index file, ref names, as well as
1654 path names in command line arguments, environment variables
1655 and config files (
<code>.git/config
</code> (see
<a href=
"git-config.html">git-config(
1)
</a>),
1656 <a href=
"gitignore.html">gitignore(
5)
</a>,
<a href=
"gitattributes.html">gitattributes(
5)
</a> and
1657 <a href=
"gitmodules.html">gitmodules(
5)
</a>).
1659 <div class=
"paragraph"><p>Note that Git at the core level treats path names simply as
1660 sequences of non-NUL bytes, there are no path name encoding
1661 conversions (except on Mac and Windows). Therefore, using
1662 non-ASCII path names will mostly work even on platforms and file
1663 systems that use legacy extended ASCII encodings. However,
1664 repositories created on such systems will not work properly on
1665 UTF-
8-based systems (e.g. Linux, Mac, Windows) and vice versa.
1666 Additionally, many Git-based tools simply assume path names to
1667 be UTF-
8 and will fail to display other encodings correctly.
</p></div>
1671 Commit log messages are typically encoded in UTF-
8, but other
1672 extended ASCII encodings are also supported. This includes
1673 ISO-
8859-x, CP125x and many others, but
<em>not
</em> UTF-
16/
32,
1674 EBCDIC and CJK multi-byte encodings (GBK, Shift-JIS, Big5,
1679 <div class=
"paragraph"><p>Although we encourage that the commit log messages are encoded
1680 in UTF-
8, both the core and Git Porcelain are designed not to
1681 force UTF-
8 on projects. If all participants of a particular
1682 project find it more convenient to use legacy encodings, Git
1683 does not forbid it. However, there are a few things to keep in
1685 <div class=
"olist arabic"><ol class=
"arabic">
1688 <em>git commit
</em> and
<em>git commit-tree
</em> issue
1689 a warning if the commit log message given to it does not look
1690 like a valid UTF-
8 string, unless you explicitly say your
1691 project uses a legacy encoding. The way to say this is to
1692 have
<code>i18n.commitEncoding
</code> in
<code>.git/config
</code> file, like this:
1694 <div class=
"listingblock">
1695 <div class=
"content">
1697 commitEncoding = ISO-
8859-
1</code></pre>
1699 <div class=
"paragraph"><p>Commit objects created with the above setting record the value
1700 of
<code>i18n.commitEncoding
</code> in their
<code>encoding
</code> header. This is to
1701 help other people who look at them later. Lack of this header
1702 implies that the commit log message is encoded in UTF-
8.
</p></div>
1706 <em>git log
</em>,
<em>git show
</em>,
<em>git blame
</em> and friends look at the
1707 <code>encoding
</code> header of a commit object, and try to re-code the
1708 log message into UTF-
8 unless otherwise specified. You can
1709 specify the desired output encoding with
1710 <code>i18n.logOutputEncoding
</code> in
<code>.git/config
</code> file, like this:
1712 <div class=
"listingblock">
1713 <div class=
"content">
1715 logOutputEncoding = ISO-
8859-
1</code></pre>
1717 <div class=
"paragraph"><p>If you do not have this configuration variable, the value of
1718 <code>i18n.commitEncoding
</code> is used instead.
</p></div>
1721 <div class=
"paragraph"><p>Note that we deliberately chose not to re-code the commit log
1722 message when a commit is made to force UTF-
8 at the commit
1723 object level, because re-coding to UTF-
8 is not necessarily a
1724 reversible operation.
</p></div>
1728 <h2 id=
"_environment_and_configuration_variables">ENVIRONMENT AND CONFIGURATION VARIABLES
</h2>
1729 <div class=
"sectionbody">
1730 <div class=
"paragraph"><p>The editor used to edit the commit log message will be chosen from the
1731 <code>GIT_EDITOR
</code> environment variable, the core.editor configuration variable, the
1732 <code>VISUAL
</code> environment variable, or the
<code>EDITOR
</code> environment variable (in that
1733 order). See
<a href=
"git-var.html">git-var(
1)
</a> for details.
</p></div>
1734 <div class=
"paragraph"><p>Everything above this line in this section isn
’t included from the
1735 <a href=
"git-config.html">git-config(
1)
</a> documentation. The content that follows is the
1736 same as what
’s found there:
</p></div>
1737 <div class=
"dlist"><dl>
1738 <dt class=
"hdlist1">
1743 This setting overrides the default of the
<code>--cleanup
</code> option in
1744 <code>git commit
</code>. See
<a href=
"git-commit.html">git-commit(
1)
</a> for details. Changing the
1745 default can be useful when you always want to keep lines that begin
1746 with the comment character
<code>#
</code> in your log message, in which case you
1747 would do
<code>git config commit.cleanup whitespace
</code> (note that you will
1748 have to remove the help lines that begin with
<code>#
</code> in the commit log
1749 template yourself, if you do this).
1752 <dt class=
"hdlist1">
1757 A boolean to specify whether all commits should be GPG signed.
1758 Use of this option when doing operations such as rebase can
1759 result in a large number of commits being signed. It may be
1760 convenient to use an agent to avoid typing your GPG passphrase
1764 <dt class=
"hdlist1">
1769 A boolean to enable/disable inclusion of status information in the
1770 commit message template when using an editor to prepare the commit
1771 message. Defaults to true.
1774 <dt class=
"hdlist1">
1779 Specify the pathname of a file to use as the template for
1780 new commit messages.
1783 <dt class=
"hdlist1">
1788 A boolean or int to specify the level of verbosity with
<code>git commit
</code>.
1789 See
<a href=
"git-commit.html">git-commit(
1)
</a>.
1796 <h2 id=
"_hooks">HOOKS
</h2>
1797 <div class=
"sectionbody">
1798 <div class=
"paragraph"><p>This command can run
<code>commit-msg
</code>,
<code>prepare-commit-msg
</code>,
<code>pre-commit
</code>,
1799 <code>post-commit
</code> and
<code>post-rewrite
</code> hooks. See
<a href=
"githooks.html">githooks(
5)
</a> for more
1800 information.
</p></div>
1804 <h2 id=
"_files">FILES
</h2>
1805 <div class=
"sectionbody">
1806 <div class=
"dlist"><dl>
1807 <dt class=
"hdlist1">
1808 <code>$GIT_DIR/COMMIT_EDITMSG
</code>
1812 This file contains the commit message of a commit in progress.
1813 If
<code>git commit
</code> exits due to an error before creating a commit,
1814 any commit message that has been provided by the user (e.g., in
1815 an editor session) will be available in this file, but will be
1816 overwritten by the next invocation of
<code>git commit
</code>.
1823 <h2 id=
"_see_also">SEE ALSO
</h2>
1824 <div class=
"sectionbody">
1825 <div class=
"paragraph"><p><a href=
"git-add.html">git-add(
1)
</a>,
1826 <a href=
"git-rm.html">git-rm(
1)
</a>,
1827 <a href=
"git-mv.html">git-mv(
1)
</a>,
1828 <a href=
"git-merge.html">git-merge(
1)
</a>,
1829 <a href=
"git-commit-tree.html">git-commit-tree(
1)
</a></p></div>
1833 <h2 id=
"_git">GIT
</h2>
1834 <div class=
"sectionbody">
1835 <div class=
"paragraph"><p>Part of the
<a href=
"git.html">git(
1)
</a> suite
</p></div>
1839 <div id=
"footnotes"><hr /></div>
1841 <div id=
"footer-text">
1843 2023-
10-
04 15:
43:
56 PDT