Autogenerated HTML docs for v1.7.3.3-402-ga48aa
[git/jnareb-git.git] / git-commit.html
blob8b54d7972b87e33fdcb3f03b989b8e5375960f9d
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6 <meta name="generator" content="AsciiDoc 8.4.5" />
7 <title>git-commit(1)</title>
8 <style type="text/css">
9 /* Debug borders */
10 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
12 border: 1px solid red;
16 body {
17 margin: 1em 5% 1em 5%;
20 a {
21 color: blue;
22 text-decoration: underline;
24 a:visited {
25 color: fuchsia;
28 em {
29 font-style: italic;
30 color: navy;
33 strong {
34 font-weight: bold;
35 color: #083194;
38 tt {
39 color: navy;
42 h1, h2, h3, h4, h5, h6 {
43 color: #527bbd;
44 font-family: sans-serif;
45 margin-top: 1.2em;
46 margin-bottom: 0.5em;
47 line-height: 1.3;
50 h1, h2, h3 {
51 border-bottom: 2px solid silver;
53 h2 {
54 padding-top: 0.5em;
56 h3 {
57 float: left;
59 h3 + * {
60 clear: left;
63 div.sectionbody {
64 font-family: serif;
65 margin-left: 0;
68 hr {
69 border: 1px solid silver;
72 p {
73 margin-top: 0.5em;
74 margin-bottom: 0.5em;
77 ul, ol, li > p {
78 margin-top: 0;
81 pre {
82 padding: 0;
83 margin: 0;
86 span#author {
87 color: #527bbd;
88 font-family: sans-serif;
89 font-weight: bold;
90 font-size: 1.1em;
92 span#email {
94 span#revnumber, span#revdate, span#revremark {
95 font-family: sans-serif;
98 div#footer {
99 font-family: sans-serif;
100 font-size: small;
101 border-top: 2px solid silver;
102 padding-top: 0.5em;
103 margin-top: 4.0em;
105 div#footer-text {
106 float: left;
107 padding-bottom: 0.5em;
109 div#footer-badges {
110 float: right;
111 padding-bottom: 0.5em;
114 div#preamble {
115 margin-top: 1.5em;
116 margin-bottom: 1.5em;
118 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
119 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
120 div.admonitionblock {
121 margin-top: 1.5em;
122 margin-bottom: 1.5em;
124 div.admonitionblock {
125 margin-top: 2.5em;
126 margin-bottom: 2.5em;
129 div.content { /* Block element content. */
130 padding: 0;
133 /* Block element titles. */
134 div.title, caption.title {
135 color: #527bbd;
136 font-family: sans-serif;
137 font-weight: bold;
138 text-align: left;
139 margin-top: 1.0em;
140 margin-bottom: 0.5em;
142 div.title + * {
143 margin-top: 0;
146 td div.title:first-child {
147 margin-top: 0.0em;
149 div.content div.title:first-child {
150 margin-top: 0.0em;
152 div.content + div.title {
153 margin-top: 0.0em;
156 div.sidebarblock > div.content {
157 background: #ffffee;
158 border: 1px solid silver;
159 padding: 0.5em;
162 div.listingblock > div.content {
163 border: 1px solid silver;
164 background: #f4f4f4;
165 padding: 0.5em;
168 div.quoteblock {
169 padding-left: 2.0em;
170 margin-right: 10%;
172 div.quoteblock > div.attribution {
173 padding-top: 0.5em;
174 text-align: right;
177 div.verseblock {
178 padding-left: 2.0em;
179 margin-right: 10%;
181 div.verseblock > div.content {
182 white-space: pre;
184 div.verseblock > div.attribution {
185 padding-top: 0.75em;
186 text-align: left;
188 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
189 div.verseblock + div.attribution {
190 text-align: left;
193 div.admonitionblock .icon {
194 vertical-align: top;
195 font-size: 1.1em;
196 font-weight: bold;
197 text-decoration: underline;
198 color: #527bbd;
199 padding-right: 0.5em;
201 div.admonitionblock td.content {
202 padding-left: 0.5em;
203 border-left: 2px solid silver;
206 div.exampleblock > div.content {
207 border-left: 2px solid silver;
208 padding: 0.5em;
211 div.imageblock div.content { padding-left: 0; }
212 span.image img { border-style: none; }
213 a.image:visited { color: white; }
215 dl {
216 margin-top: 0.8em;
217 margin-bottom: 0.8em;
219 dt {
220 margin-top: 0.5em;
221 margin-bottom: 0;
222 font-style: normal;
223 color: navy;
225 dd > *:first-child {
226 margin-top: 0.1em;
229 ul, ol {
230 list-style-position: outside;
232 ol.arabic {
233 list-style-type: decimal;
235 ol.loweralpha {
236 list-style-type: lower-alpha;
238 ol.upperalpha {
239 list-style-type: upper-alpha;
241 ol.lowerroman {
242 list-style-type: lower-roman;
244 ol.upperroman {
245 list-style-type: upper-roman;
248 div.compact ul, div.compact ol,
249 div.compact p, div.compact p,
250 div.compact div, div.compact div {
251 margin-top: 0.1em;
252 margin-bottom: 0.1em;
255 div.tableblock > table {
256 border: 3px solid #527bbd;
258 thead {
259 font-family: sans-serif;
260 font-weight: bold;
262 tfoot {
263 font-weight: bold;
265 td > div.verse {
266 white-space: pre;
268 p.table {
269 margin-top: 0;
271 /* Because the table frame attribute is overriden by CSS in most browsers. */
272 div.tableblock > table[frame="void"] {
273 border-style: none;
275 div.tableblock > table[frame="hsides"] {
276 border-left-style: none;
277 border-right-style: none;
279 div.tableblock > table[frame="vsides"] {
280 border-top-style: none;
281 border-bottom-style: none;
285 div.hdlist {
286 margin-top: 0.8em;
287 margin-bottom: 0.8em;
289 div.hdlist tr {
290 padding-bottom: 15px;
292 dt.hdlist1.strong, td.hdlist1.strong {
293 font-weight: bold;
295 td.hdlist1 {
296 vertical-align: top;
297 font-style: normal;
298 padding-right: 0.8em;
299 color: navy;
301 td.hdlist2 {
302 vertical-align: top;
304 div.hdlist.compact tr {
305 margin: 0;
306 padding-bottom: 0;
309 .comment {
310 background: yellow;
313 @media print {
314 div#footer-badges { display: none; }
317 div#toctitle {
318 color: #527bbd;
319 font-family: sans-serif;
320 font-size: 1.1em;
321 font-weight: bold;
322 margin-top: 1.0em;
323 margin-bottom: 0.1em;
326 div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
327 margin-top: 0;
328 margin-bottom: 0;
330 div.toclevel2 {
331 margin-left: 2em;
332 font-size: 0.9em;
334 div.toclevel3 {
335 margin-left: 4em;
336 font-size: 0.9em;
338 div.toclevel4 {
339 margin-left: 6em;
340 font-size: 0.9em;
342 /* Overrides for manpage documents */
343 h1 {
344 padding-top: 0.5em;
345 padding-bottom: 0.5em;
346 border-top: 2px solid silver;
347 border-bottom: 2px solid silver;
349 h2 {
350 border-style: none;
352 div.sectionbody {
353 margin-left: 5%;
356 @media print {
357 div#toc { display: none; }
360 /* Workarounds for IE6's broken and incomplete CSS2. */
362 div.sidebar-content {
363 background: #ffffee;
364 border: 1px solid silver;
365 padding: 0.5em;
367 div.sidebar-title, div.image-title {
368 color: #527bbd;
369 font-family: sans-serif;
370 font-weight: bold;
371 margin-top: 0.0em;
372 margin-bottom: 0.5em;
375 div.listingblock div.content {
376 border: 1px solid silver;
377 background: #f4f4f4;
378 padding: 0.5em;
381 div.quoteblock-attribution {
382 padding-top: 0.5em;
383 text-align: right;
386 div.verseblock-content {
387 white-space: pre;
389 div.verseblock-attribution {
390 padding-top: 0.75em;
391 text-align: left;
394 div.exampleblock-content {
395 border-left: 2px solid silver;
396 padding-left: 0.5em;
399 /* IE6 sets dynamically generated links as visited. */
400 div#toc a:visited { color: blue; }
401 </style>
402 </head>
403 <body>
404 <div id="header">
405 <h1>
406 git-commit(1) Manual Page
407 </h1>
408 <h2>NAME</h2>
409 <div class="sectionbody">
410 <p>git-commit -
411 Record changes to the repository
412 </p>
413 </div>
414 </div>
415 <h2 id="_synopsis">SYNOPSIS</h2>
416 <div class="sectionbody">
417 <div class="verseblock">
418 <div class="verseblock-content"><em>git commit</em> [-a | --interactive] [-s] [-v] [-u&lt;mode&gt;] [--amend] [--dry-run]
419 [(-c | -C | --fixup | --squash) &lt;commit&gt;] [-F &lt;file&gt; | -m &lt;msg&gt;]
420 [--reset-author] [--allow-empty] [--allow-empty-message] [--no-verify]
421 [-e] [--author=&lt;author&gt;] [--date=&lt;date&gt;] [--cleanup=&lt;mode&gt;]
422 [--status | --no-status] [-i | -o] [--] [&lt;file&gt;&#8230;]</div>
423 <div class="verseblock-attribution">
424 </div></div>
425 </div>
426 <h2 id="_description">DESCRIPTION</h2>
427 <div class="sectionbody">
428 <div class="paragraph"><p>Stores the current contents of the index in a new commit along
429 with a log message from the user describing the changes.</p></div>
430 <div class="paragraph"><p>The content to be added can be specified in several ways:</p></div>
431 <div class="olist arabic"><ol class="arabic">
432 <li>
434 by using <em>git add</em> to incrementally "add" changes to the
435 index before using the <em>commit</em> command (Note: even modified
436 files must be "added");
437 </p>
438 </li>
439 <li>
441 by using <em>git rm</em> to remove files from the working tree
442 and the index, again before using the <em>commit</em> command;
443 </p>
444 </li>
445 <li>
447 by listing files as arguments to the <em>commit</em> command, in which
448 case the commit will ignore changes staged in the index, and instead
449 record the current content of the listed files (which must already
450 be known to git);
451 </p>
452 </li>
453 <li>
455 by using the -a switch with the <em>commit</em> command to automatically
456 "add" changes from all known files (i.e. all files that are already
457 listed in the index) and to automatically "rm" files in the index
458 that have been removed from the working tree, and then perform the
459 actual commit;
460 </p>
461 </li>
462 <li>
464 by using the --interactive switch with the <em>commit</em> command to decide one
465 by one which files should be part of the commit, before finalizing the
466 operation. Currently, this is done by invoking <em>git add --interactive</em>.
467 </p>
468 </li>
469 </ol></div>
470 <div class="paragraph"><p>The <tt>--dry-run</tt> option can be used to obtain a
471 summary of what is included by any of the above for the next
472 commit by giving the same set of parameters (options and paths).</p></div>
473 <div class="paragraph"><p>If you make a commit and then find a mistake immediately after
474 that, you can recover from it with <em>git reset</em>.</p></div>
475 </div>
476 <h2 id="_options">OPTIONS</h2>
477 <div class="sectionbody">
478 <div class="dlist"><dl>
479 <dt class="hdlist1">
481 </dt>
482 <dt class="hdlist1">
483 --all
484 </dt>
485 <dd>
487 Tell the command to automatically stage files that have
488 been modified and deleted, but new files you have not
489 told git about are not affected.
490 </p>
491 </dd>
492 <dt class="hdlist1">
493 -C &lt;commit&gt;
494 </dt>
495 <dt class="hdlist1">
496 --reuse-message=&lt;commit&gt;
497 </dt>
498 <dd>
500 Take an existing commit object, and reuse the log message
501 and the authorship information (including the timestamp)
502 when creating the commit.
503 </p>
504 </dd>
505 <dt class="hdlist1">
506 -c &lt;commit&gt;
507 </dt>
508 <dt class="hdlist1">
509 --reedit-message=&lt;commit&gt;
510 </dt>
511 <dd>
513 Like <em>-C</em>, but with <em>-c</em> the editor is invoked, so that
514 the user can further edit the commit message.
515 </p>
516 </dd>
517 <dt class="hdlist1">
518 --fixup=&lt;commit&gt;
519 </dt>
520 <dd>
522 Construct a commit message for use with <tt>rebase --autosquash</tt>.
523 The commit message will be the subject line from the specified
524 commit with a prefix of "fixup! ". See <a href="git-rebase.html">git-rebase(1)</a>
525 for details.
526 </p>
527 </dd>
528 <dt class="hdlist1">
529 --squash=&lt;commit&gt;
530 </dt>
531 <dd>
533 Construct a commit message for use with <tt>rebase --autosquash</tt>.
534 The commit message subject line is taken from the specified
535 commit with a prefix of "squash! ". Can be used with additional
536 commit message options (<tt>-m</tt>/<tt>-c</tt>/<tt>-C</tt>/<tt>-F</tt>). See
537 <a href="git-rebase.html">git-rebase(1)</a> for details.
538 </p>
539 </dd>
540 <dt class="hdlist1">
541 --reset-author
542 </dt>
543 <dd>
545 When used with -C/-c/--amend options, declare that the
546 authorship of the resulting commit now belongs of the committer.
547 This also renews the author timestamp.
548 </p>
549 </dd>
550 <dt class="hdlist1">
551 --short
552 </dt>
553 <dd>
555 When doing a dry-run, give the output in the short-format. See
556 <a href="git-status.html">git-status(1)</a> for details. Implies <tt>--dry-run</tt>.
557 </p>
558 </dd>
559 <dt class="hdlist1">
560 --porcelain
561 </dt>
562 <dd>
564 When doing a dry-run, give the output in a porcelain-ready
565 format. See <a href="git-status.html">git-status(1)</a> for details. Implies
566 <tt>--dry-run</tt>.
567 </p>
568 </dd>
569 <dt class="hdlist1">
571 </dt>
572 <dd>
574 When showing <tt>short</tt> or <tt>porcelain</tt> status output, terminate
575 entries in the status output with NUL, instead of LF. If no
576 format is given, implies the <tt>--porcelain</tt> output format.
577 </p>
578 </dd>
579 <dt class="hdlist1">
580 -F &lt;file&gt;
581 </dt>
582 <dt class="hdlist1">
583 --file=&lt;file&gt;
584 </dt>
585 <dd>
587 Take the commit message from the given file. Use <em>-</em> to
588 read the message from the standard input.
589 </p>
590 </dd>
591 <dt class="hdlist1">
592 --author=&lt;author&gt;
593 </dt>
594 <dd>
596 Override the commit author. Specify an explicit author using the
597 standard <tt>A U Thor &lt;<a href="mailto:author@example.com">author@example.com</a>&gt;</tt> format. Otherwise &lt;author&gt;
598 is assumed to be a pattern and is used to search for an existing
599 commit by that author (i.e. rev-list --all -i --author=&lt;author&gt;);
600 the commit author is then copied from the first such commit found.
601 </p>
602 </dd>
603 <dt class="hdlist1">
604 --date=&lt;date&gt;
605 </dt>
606 <dd>
608 Override the author date used in the commit.
609 </p>
610 </dd>
611 <dt class="hdlist1">
612 -m &lt;msg&gt;
613 </dt>
614 <dt class="hdlist1">
615 --message=&lt;msg&gt;
616 </dt>
617 <dd>
619 Use the given &lt;msg&gt; as the commit message.
620 </p>
621 </dd>
622 <dt class="hdlist1">
623 -t &lt;file&gt;
624 </dt>
625 <dt class="hdlist1">
626 --template=&lt;file&gt;
627 </dt>
628 <dd>
630 Use the contents of the given file as the initial version
631 of the commit message. The editor is invoked and you can
632 make subsequent changes. If a message is specified using
633 the <tt>-m</tt> or <tt>-F</tt> options, this option has no effect. This
634 overrides the <tt>commit.template</tt> configuration variable.
635 </p>
636 </dd>
637 <dt class="hdlist1">
639 </dt>
640 <dt class="hdlist1">
641 --signoff
642 </dt>
643 <dd>
645 Add Signed-off-by line by the committer at the end of the commit
646 log message.
647 </p>
648 </dd>
649 <dt class="hdlist1">
651 </dt>
652 <dt class="hdlist1">
653 --no-verify
654 </dt>
655 <dd>
657 This option bypasses the pre-commit and commit-msg hooks.
658 See also <a href="githooks.html">githooks(5)</a>.
659 </p>
660 </dd>
661 <dt class="hdlist1">
662 --allow-empty
663 </dt>
664 <dd>
666 Usually recording a commit that has the exact same tree as its
667 sole parent commit is a mistake, and the command prevents you
668 from making such a commit. This option bypasses the safety, and
669 is primarily for use by foreign SCM interface scripts.
670 </p>
671 </dd>
672 <dt class="hdlist1">
673 --allow-empty-message
674 </dt>
675 <dd>
677 Like --allow-empty this command is primarily for use by foreign
678 SCM interface scripts. It allows you to create a commit with an
679 empty commit message without using plumbing commands like
680 <a href="git-commit-tree.html">git-commit-tree(1)</a>.
681 </p>
682 </dd>
683 <dt class="hdlist1">
684 --cleanup=&lt;mode&gt;
685 </dt>
686 <dd>
688 This option sets how the commit message is cleaned up.
689 The <em>&lt;mode&gt;</em> can be one of <em>verbatim</em>, <em>whitespace</em>, <em>strip</em>,
690 and <em>default</em>. The <em>default</em> mode will strip leading and
691 trailing empty lines and #commentary from the commit message
692 only if the message is to be edited. Otherwise only whitespace
693 removed. The <em>verbatim</em> mode does not change message at all,
694 <em>whitespace</em> removes just leading/trailing whitespace lines
695 and <em>strip</em> removes both whitespace and commentary.
696 </p>
697 </dd>
698 <dt class="hdlist1">
700 </dt>
701 <dt class="hdlist1">
702 --edit
703 </dt>
704 <dd>
706 The message taken from file with <tt>-F</tt>, command line with
707 <tt>-m</tt>, and from file with <tt>-C</tt> are usually used as the
708 commit log message unmodified. This option lets you
709 further edit the message taken from these sources.
710 </p>
711 </dd>
712 <dt class="hdlist1">
713 --amend
714 </dt>
715 <dd>
717 Used to amend the tip of the current branch. Prepare the tree
718 object you would want to replace the latest commit as usual
719 (this includes the usual -i/-o and explicit paths), and the
720 commit log editor is seeded with the commit message from the
721 tip of the current branch. The commit you create replaces the
722 current tip&#8201;&#8212;&#8201;if it was a merge, it will have the parents of
723 the current tip as parents&#8201;&#8212;&#8201;so the current top commit is
724 discarded.
725 </p>
726 <div class="paragraph"><p>It is a rough equivalent for:</p></div>
727 <div class="listingblock">
728 <div class="content">
729 <pre><tt> $ git reset --soft HEAD^
730 $ ... do something else to come up with the right tree ...
731 $ git commit -c ORIG_HEAD</tt></pre>
732 </div></div>
733 <div class="paragraph"><p>but can be used to amend a merge commit.</p></div>
734 <div class="paragraph"><p>You should understand the implications of rewriting history if you
735 amend a commit that has already been published. (See the "RECOVERING
736 FROM UPSTREAM REBASE" section in <a href="git-rebase.html">git-rebase(1)</a>.)</p></div>
737 </dd>
738 <dt class="hdlist1">
740 </dt>
741 <dt class="hdlist1">
742 --include
743 </dt>
744 <dd>
746 Before making a commit out of staged contents so far,
747 stage the contents of paths given on the command line
748 as well. This is usually not what you want unless you
749 are concluding a conflicted merge.
750 </p>
751 </dd>
752 <dt class="hdlist1">
754 </dt>
755 <dt class="hdlist1">
756 --only
757 </dt>
758 <dd>
760 Make a commit only from the paths specified on the
761 command line, disregarding any contents that have been
762 staged so far. This is the default mode of operation of
763 <em>git commit</em> if any paths are given on the command line,
764 in which case this option can be omitted.
765 If this option is specified together with <em>--amend</em>, then
766 no paths need to be specified, which can be used to amend
767 the last commit without committing changes that have
768 already been staged.
769 </p>
770 </dd>
771 <dt class="hdlist1">
772 -u[&lt;mode&gt;]
773 </dt>
774 <dt class="hdlist1">
775 --untracked-files[=&lt;mode&gt;]
776 </dt>
777 <dd>
779 Show untracked files (Default: <em>all</em>).
780 </p>
781 <div class="paragraph"><p>The mode parameter is optional, and is used to specify
782 the handling of untracked files.</p></div>
783 <div class="paragraph"><p>The possible options are:</p></div>
784 <div class="ulist"><ul>
785 <li>
787 <em>no</em> - Show no untracked files
788 </p>
789 </li>
790 <li>
792 <em>normal</em> - Shows untracked files and directories
793 </p>
794 </li>
795 <li>
797 <em>all</em> - Also shows individual files in untracked directories.
798 </p>
799 <div class="paragraph"><p>See <a href="git-config.html">git-config(1)</a> for configuration variable
800 used to change the default for when the option is not
801 specified.</p></div>
802 </li>
803 </ul></div>
804 </dd>
805 <dt class="hdlist1">
807 </dt>
808 <dt class="hdlist1">
809 --verbose
810 </dt>
811 <dd>
813 Show unified diff between the HEAD commit and what
814 would be committed at the bottom of the commit message
815 template. Note that this diff output doesn&#8217;t have its
816 lines prefixed with <em>#</em>.
817 </p>
818 </dd>
819 <dt class="hdlist1">
821 </dt>
822 <dt class="hdlist1">
823 --quiet
824 </dt>
825 <dd>
827 Suppress commit summary message.
828 </p>
829 </dd>
830 <dt class="hdlist1">
831 --dry-run
832 </dt>
833 <dd>
835 Do not create a commit, but show a list of paths that are
836 to be committed, paths with local changes that will be left
837 uncommitted and paths that are untracked.
838 </p>
839 </dd>
840 <dt class="hdlist1">
841 --status
842 </dt>
843 <dd>
845 Include the output of <a href="git-status.html">git-status(1)</a> in the commit
846 message template when using an editor to prepare the commit
847 message. Defaults to on, but can be used to override
848 configuration variable commit.status.
849 </p>
850 </dd>
851 <dt class="hdlist1">
852 --no-status
853 </dt>
854 <dd>
856 Do not include the output of <a href="git-status.html">git-status(1)</a> in the
857 commit message template when using an editor to prepare the
858 default commit message.
859 </p>
860 </dd>
861 <dt class="hdlist1">
863 </dt>
864 <dd>
866 Do not interpret any more arguments as options.
867 </p>
868 </dd>
869 <dt class="hdlist1">
870 &lt;file&gt;&#8230;
871 </dt>
872 <dd>
874 When files are given on the command line, the command
875 commits the contents of the named files, without
876 recording the changes already staged. The contents of
877 these files are also staged for the next commit on top
878 of what have been staged before.
879 </p>
880 </dd>
881 </dl></div>
882 </div>
883 <h2 id="_date_formats">DATE FORMATS</h2>
884 <div class="sectionbody">
885 <div class="paragraph"><p>The GIT_AUTHOR_DATE, GIT_COMMITTER_DATE environment variables
886 and the <tt>--date</tt> option
887 support the following date formats:</p></div>
888 <div class="dlist"><dl>
889 <dt class="hdlist1">
890 Git internal format
891 </dt>
892 <dd>
894 It is <tt>&lt;unix timestamp&gt; &lt;timezone offset&gt;</tt>, where <tt>&lt;unix
895 timestamp&gt;</tt> is the number of seconds since the UNIX epoch.
896 <tt>&lt;timezone offset&gt;</tt> is a positive or negative offset from UTC.
897 For example CET (which is 2 hours ahead UTC) is <tt>+0200</tt>.
898 </p>
899 </dd>
900 <dt class="hdlist1">
901 RFC 2822
902 </dt>
903 <dd>
905 The standard email format as described by RFC 2822, for example
906 <tt>Thu, 07 Apr 2005 22:13:13 +0200</tt>.
907 </p>
908 </dd>
909 <dt class="hdlist1">
910 ISO 8601
911 </dt>
912 <dd>
914 Time and date specified by the ISO 8601 standard, for example
915 <tt>2005-04-07T22:13:13</tt>. The parser accepts a space instead of the
916 <tt>T</tt> character as well.
917 </p>
918 <div class="admonitionblock">
919 <table><tr>
920 <td class="icon">
921 <div class="title">Note</div>
922 </td>
923 <td class="content">In addition, the date part is accepted in the following formats:
924 <tt>YYYY.MM.DD</tt>, <tt>MM/DD/YYYY</tt> and <tt>DD.MM.YYYY</tt>.</td>
925 </tr></table>
926 </div>
927 </dd>
928 </dl></div>
929 </div>
930 <h2 id="_examples">EXAMPLES</h2>
931 <div class="sectionbody">
932 <div class="paragraph"><p>When recording your own work, the contents of modified files in
933 your working tree are temporarily stored to a staging area
934 called the "index" with <em>git add</em>. A file can be
935 reverted back, only in the index but not in the working tree,
936 to that of the last commit with <tt>git reset HEAD&#8201;&#8212;&#8201;&lt;file&gt;</tt>,
937 which effectively reverts <em>git add</em> and prevents the changes to
938 this file from participating in the next commit. After building
939 the state to be committed incrementally with these commands,
940 <tt>git commit</tt> (without any pathname parameter) is used to record what
941 has been staged so far. This is the most basic form of the
942 command. An example:</p></div>
943 <div class="listingblock">
944 <div class="content">
945 <pre><tt>$ edit hello.c
946 $ git rm goodbye.c
947 $ git add hello.c
948 $ git commit</tt></pre>
949 </div></div>
950 <div class="paragraph"><p>Instead of staging files after each individual change, you can
951 tell <tt>git commit</tt> to notice the changes to the files whose
952 contents are tracked in
953 your working tree and do corresponding <tt>git add</tt> and <tt>git rm</tt>
954 for you. That is, this example does the same as the earlier
955 example if there is no other change in your working tree:</p></div>
956 <div class="listingblock">
957 <div class="content">
958 <pre><tt>$ edit hello.c
959 $ rm goodbye.c
960 $ git commit -a</tt></pre>
961 </div></div>
962 <div class="paragraph"><p>The command <tt>git commit -a</tt> first looks at your working tree,
963 notices that you have modified hello.c and removed goodbye.c,
964 and performs necessary <tt>git add</tt> and <tt>git rm</tt> for you.</p></div>
965 <div class="paragraph"><p>After staging changes to many files, you can alter the order the
966 changes are recorded in, by giving pathnames to <tt>git commit</tt>.
967 When pathnames are given, the command makes a commit that
968 only records the changes made to the named paths:</p></div>
969 <div class="listingblock">
970 <div class="content">
971 <pre><tt>$ edit hello.c hello.h
972 $ git add hello.c hello.h
973 $ edit Makefile
974 $ git commit Makefile</tt></pre>
975 </div></div>
976 <div class="paragraph"><p>This makes a commit that records the modification to <tt>Makefile</tt>.
977 The changes staged for <tt>hello.c</tt> and <tt>hello.h</tt> are not included
978 in the resulting commit. However, their changes are not lost&#8201;&#8212;&#8201;they are still staged and merely held back. After the above
979 sequence, if you do:</p></div>
980 <div class="listingblock">
981 <div class="content">
982 <pre><tt>$ git commit</tt></pre>
983 </div></div>
984 <div class="paragraph"><p>this second commit would record the changes to <tt>hello.c</tt> and
985 <tt>hello.h</tt> as expected.</p></div>
986 <div class="paragraph"><p>After a merge (initiated by <em>git merge</em> or <em>git pull</em>) stops
987 because of conflicts, cleanly merged
988 paths are already staged to be committed for you, and paths that
989 conflicted are left in unmerged state. You would have to first
990 check which paths are conflicting with <em>git status</em>
991 and after fixing them manually in your working tree, you would
992 stage the result as usual with <em>git add</em>:</p></div>
993 <div class="listingblock">
994 <div class="content">
995 <pre><tt>$ git status | grep unmerged
996 unmerged: hello.c
997 $ edit hello.c
998 $ git add hello.c</tt></pre>
999 </div></div>
1000 <div class="paragraph"><p>After resolving conflicts and staging the result, <tt>git ls-files -u</tt>
1001 would stop mentioning the conflicted path. When you are done,
1002 run <tt>git commit</tt> to finally record the merge:</p></div>
1003 <div class="listingblock">
1004 <div class="content">
1005 <pre><tt>$ git commit</tt></pre>
1006 </div></div>
1007 <div class="paragraph"><p>As with the case to record your own changes, you can use <tt>-a</tt>
1008 option to save typing. One difference is that during a merge
1009 resolution, you cannot use <tt>git commit</tt> with pathnames to
1010 alter the order the changes are committed, because the merge
1011 should be recorded as a single commit. In fact, the command
1012 refuses to run when given pathnames (but see <tt>-i</tt> option).</p></div>
1013 </div>
1014 <h2 id="_discussion">DISCUSSION</h2>
1015 <div class="sectionbody">
1016 <div class="paragraph"><p>Though not required, it&#8217;s a good idea to begin the commit message
1017 with a single short (less than 50 character) line summarizing the
1018 change, followed by a blank line and then a more thorough description.
1019 Tools that turn commits into email, for example, use the first line
1020 on the Subject: line and the rest of the commit in the body.</p></div>
1021 <div class="paragraph"><p>At the core level, git is character encoding agnostic.</p></div>
1022 <div class="ulist"><ul>
1023 <li>
1025 The pathnames recorded in the index and in the tree objects
1026 are treated as uninterpreted sequences of non-NUL bytes.
1027 What readdir(2) returns are what are recorded and compared
1028 with the data git keeps track of, which in turn are expected
1029 to be what lstat(2) and creat(2) accepts. There is no such
1030 thing as pathname encoding translation.
1031 </p>
1032 </li>
1033 <li>
1035 The contents of the blob objects are uninterpreted sequences
1036 of bytes. There is no encoding translation at the core
1037 level.
1038 </p>
1039 </li>
1040 <li>
1042 The commit log messages are uninterpreted sequences of non-NUL
1043 bytes.
1044 </p>
1045 </li>
1046 </ul></div>
1047 <div class="paragraph"><p>Although we encourage that the commit log messages are encoded
1048 in UTF-8, both the core and git Porcelain are designed not to
1049 force UTF-8 on projects. If all participants of a particular
1050 project find it more convenient to use legacy encodings, git
1051 does not forbid it. However, there are a few things to keep in
1052 mind.</p></div>
1053 <div class="olist arabic"><ol class="arabic">
1054 <li>
1056 <em>git commit</em> and <em>git commit-tree</em> issues
1057 a warning if the commit log message given to it does not look
1058 like a valid UTF-8 string, unless you explicitly say your
1059 project uses a legacy encoding. The way to say this is to
1060 have i18n.commitencoding in <tt>.git/config</tt> file, like this:
1061 </p>
1062 <div class="listingblock">
1063 <div class="content">
1064 <pre><tt>[i18n]
1065 commitencoding = ISO-8859-1</tt></pre>
1066 </div></div>
1067 <div class="paragraph"><p>Commit objects created with the above setting record the value
1068 of <tt>i18n.commitencoding</tt> in its <tt>encoding</tt> header. This is to
1069 help other people who look at them later. Lack of this header
1070 implies that the commit log message is encoded in UTF-8.</p></div>
1071 </li>
1072 <li>
1074 <em>git log</em>, <em>git show</em>, <em>git blame</em> and friends look at the
1075 <tt>encoding</tt> header of a commit object, and try to re-code the
1076 log message into UTF-8 unless otherwise specified. You can
1077 specify the desired output encoding with
1078 <tt>i18n.logoutputencoding</tt> in <tt>.git/config</tt> file, like this:
1079 </p>
1080 <div class="listingblock">
1081 <div class="content">
1082 <pre><tt>[i18n]
1083 logoutputencoding = ISO-8859-1</tt></pre>
1084 </div></div>
1085 <div class="paragraph"><p>If you do not have this configuration variable, the value of
1086 <tt>i18n.commitencoding</tt> is used instead.</p></div>
1087 </li>
1088 </ol></div>
1089 <div class="paragraph"><p>Note that we deliberately chose not to re-code the commit log
1090 message when a commit is made to force UTF-8 at the commit
1091 object level, because re-coding to UTF-8 is not necessarily a
1092 reversible operation.</p></div>
1093 </div>
1094 <h2 id="_environment_and_configuration_variables">ENVIRONMENT AND CONFIGURATION VARIABLES</h2>
1095 <div class="sectionbody">
1096 <div class="paragraph"><p>The editor used to edit the commit log message will be chosen from the
1097 GIT_EDITOR environment variable, the core.editor configuration variable, the
1098 VISUAL environment variable, or the EDITOR environment variable (in that
1099 order). See <a href="git-var.html">git-var(1)</a> for details.</p></div>
1100 </div>
1101 <h2 id="_hooks">HOOKS</h2>
1102 <div class="sectionbody">
1103 <div class="paragraph"><p>This command can run <tt>commit-msg</tt>, <tt>prepare-commit-msg</tt>, <tt>pre-commit</tt>,
1104 and <tt>post-commit</tt> hooks. See <a href="githooks.html">githooks(5)</a> for more
1105 information.</p></div>
1106 </div>
1107 <h2 id="_see_also">SEE ALSO</h2>
1108 <div class="sectionbody">
1109 <div class="paragraph"><p><a href="git-add.html">git-add(1)</a>,
1110 <a href="git-rm.html">git-rm(1)</a>,
1111 <a href="git-mv.html">git-mv(1)</a>,
1112 <a href="git-merge.html">git-merge(1)</a>,
1113 <a href="git-commit-tree.html">git-commit-tree(1)</a></p></div>
1114 </div>
1115 <h2 id="_author">Author</h2>
1116 <div class="sectionbody">
1117 <div class="paragraph"><p>Written by Linus Torvalds &lt;<a href="mailto:torvalds@osdl.org">torvalds@osdl.org</a>&gt; and
1118 Junio C Hamano &lt;<a href="mailto:gitster@pobox.com">gitster@pobox.com</a>&gt;</p></div>
1119 </div>
1120 <h2 id="_git">GIT</h2>
1121 <div class="sectionbody">
1122 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
1123 </div>
1124 <div id="footer">
1125 <div id="footer-text">
1126 Last updated 2010-12-05 06:20:21 UTC
1127 </div>
1128 </div>
1129 </body>
1130 </html>