Autogenerated HTML docs for v1.7.4.1-294-gaf4c
[git/jnareb-git.git] / git-commit.html
blob9f790110eae68d1a09b31277b55dcda3eae0e66c
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, or when committing after a
546 a conflicting cherry-pick, declare that the authorship of the
547 resulting commit now belongs of the committer. This also renews
548 the author timestamp.
549 </p>
550 </dd>
551 <dt class="hdlist1">
552 --short
553 </dt>
554 <dd>
556 When doing a dry-run, give the output in the short-format. See
557 <a href="git-status.html">git-status(1)</a> for details. Implies <tt>--dry-run</tt>.
558 </p>
559 </dd>
560 <dt class="hdlist1">
561 --porcelain
562 </dt>
563 <dd>
565 When doing a dry-run, give the output in a porcelain-ready
566 format. See <a href="git-status.html">git-status(1)</a> for details. Implies
567 <tt>--dry-run</tt>.
568 </p>
569 </dd>
570 <dt class="hdlist1">
572 </dt>
573 <dd>
575 When showing <tt>short</tt> or <tt>porcelain</tt> status output, terminate
576 entries in the status output with NUL, instead of LF. If no
577 format is given, implies the <tt>--porcelain</tt> output format.
578 </p>
579 </dd>
580 <dt class="hdlist1">
581 -F &lt;file&gt;
582 </dt>
583 <dt class="hdlist1">
584 --file=&lt;file&gt;
585 </dt>
586 <dd>
588 Take the commit message from the given file. Use <em>-</em> to
589 read the message from the standard input.
590 </p>
591 </dd>
592 <dt class="hdlist1">
593 --author=&lt;author&gt;
594 </dt>
595 <dd>
597 Override the commit author. Specify an explicit author using the
598 standard <tt>A U Thor &lt;<a href="mailto:author@example.com">author@example.com</a>&gt;</tt> format. Otherwise &lt;author&gt;
599 is assumed to be a pattern and is used to search for an existing
600 commit by that author (i.e. rev-list --all -i --author=&lt;author&gt;);
601 the commit author is then copied from the first such commit found.
602 </p>
603 </dd>
604 <dt class="hdlist1">
605 --date=&lt;date&gt;
606 </dt>
607 <dd>
609 Override the author date used in the commit.
610 </p>
611 </dd>
612 <dt class="hdlist1">
613 -m &lt;msg&gt;
614 </dt>
615 <dt class="hdlist1">
616 --message=&lt;msg&gt;
617 </dt>
618 <dd>
620 Use the given &lt;msg&gt; as the commit message.
621 </p>
622 </dd>
623 <dt class="hdlist1">
624 -t &lt;file&gt;
625 </dt>
626 <dt class="hdlist1">
627 --template=&lt;file&gt;
628 </dt>
629 <dd>
631 Use the contents of the given file as the initial version
632 of the commit message. The editor is invoked and you can
633 make subsequent changes. If a message is specified using
634 the <tt>-m</tt> or <tt>-F</tt> options, this option has no effect. This
635 overrides the <tt>commit.template</tt> configuration variable.
636 </p>
637 </dd>
638 <dt class="hdlist1">
640 </dt>
641 <dt class="hdlist1">
642 --signoff
643 </dt>
644 <dd>
646 Add Signed-off-by line by the committer at the end of the commit
647 log message.
648 </p>
649 </dd>
650 <dt class="hdlist1">
652 </dt>
653 <dt class="hdlist1">
654 --no-verify
655 </dt>
656 <dd>
658 This option bypasses the pre-commit and commit-msg hooks.
659 See also <a href="githooks.html">githooks(5)</a>.
660 </p>
661 </dd>
662 <dt class="hdlist1">
663 --allow-empty
664 </dt>
665 <dd>
667 Usually recording a commit that has the exact same tree as its
668 sole parent commit is a mistake, and the command prevents you
669 from making such a commit. This option bypasses the safety, and
670 is primarily for use by foreign SCM interface scripts.
671 </p>
672 </dd>
673 <dt class="hdlist1">
674 --allow-empty-message
675 </dt>
676 <dd>
678 Like --allow-empty this command is primarily for use by foreign
679 SCM interface scripts. It allows you to create a commit with an
680 empty commit message without using plumbing commands like
681 <a href="git-commit-tree.html">git-commit-tree(1)</a>.
682 </p>
683 </dd>
684 <dt class="hdlist1">
685 --cleanup=&lt;mode&gt;
686 </dt>
687 <dd>
689 This option sets how the commit message is cleaned up.
690 The <em>&lt;mode&gt;</em> can be one of <em>verbatim</em>, <em>whitespace</em>, <em>strip</em>,
691 and <em>default</em>. The <em>default</em> mode will strip leading and
692 trailing empty lines and #commentary from the commit message
693 only if the message is to be edited. Otherwise only whitespace
694 removed. The <em>verbatim</em> mode does not change message at all,
695 <em>whitespace</em> removes just leading/trailing whitespace lines
696 and <em>strip</em> removes both whitespace and commentary.
697 </p>
698 </dd>
699 <dt class="hdlist1">
701 </dt>
702 <dt class="hdlist1">
703 --edit
704 </dt>
705 <dd>
707 The message taken from file with <tt>-F</tt>, command line with
708 <tt>-m</tt>, and from file with <tt>-C</tt> are usually used as the
709 commit log message unmodified. This option lets you
710 further edit the message taken from these sources.
711 </p>
712 </dd>
713 <dt class="hdlist1">
714 --amend
715 </dt>
716 <dd>
718 Used to amend the tip of the current branch. Prepare the tree
719 object you would want to replace the latest commit as usual
720 (this includes the usual -i/-o and explicit paths), and the
721 commit log editor is seeded with the commit message from the
722 tip of the current branch. The commit you create replaces the
723 current tip&#8201;&#8212;&#8201;if it was a merge, it will have the parents of
724 the current tip as parents&#8201;&#8212;&#8201;so the current top commit is
725 discarded.
726 </p>
727 <div class="paragraph"><p>It is a rough equivalent for:</p></div>
728 <div class="listingblock">
729 <div class="content">
730 <pre><tt> $ git reset --soft HEAD^
731 $ ... do something else to come up with the right tree ...
732 $ git commit -c ORIG_HEAD</tt></pre>
733 </div></div>
734 <div class="paragraph"><p>but can be used to amend a merge commit.</p></div>
735 <div class="paragraph"><p>You should understand the implications of rewriting history if you
736 amend a commit that has already been published. (See the "RECOVERING
737 FROM UPSTREAM REBASE" section in <a href="git-rebase.html">git-rebase(1)</a>.)</p></div>
738 </dd>
739 <dt class="hdlist1">
741 </dt>
742 <dt class="hdlist1">
743 --include
744 </dt>
745 <dd>
747 Before making a commit out of staged contents so far,
748 stage the contents of paths given on the command line
749 as well. This is usually not what you want unless you
750 are concluding a conflicted merge.
751 </p>
752 </dd>
753 <dt class="hdlist1">
755 </dt>
756 <dt class="hdlist1">
757 --only
758 </dt>
759 <dd>
761 Make a commit only from the paths specified on the
762 command line, disregarding any contents that have been
763 staged so far. This is the default mode of operation of
764 <em>git commit</em> if any paths are given on the command line,
765 in which case this option can be omitted.
766 If this option is specified together with <em>--amend</em>, then
767 no paths need to be specified, which can be used to amend
768 the last commit without committing changes that have
769 already been staged.
770 </p>
771 </dd>
772 <dt class="hdlist1">
773 -u[&lt;mode&gt;]
774 </dt>
775 <dt class="hdlist1">
776 --untracked-files[=&lt;mode&gt;]
777 </dt>
778 <dd>
780 Show untracked files.
781 </p>
782 <div class="paragraph"><p>The mode parameter is optional (defaults to <em>all</em>), and is used to
783 specify the handling of untracked files; when -u is not used, the
784 default is <em>normal</em>, i.e. show untracked files and directories.</p></div>
785 <div class="paragraph"><p>The possible options are:</p></div>
786 <div class="ulist"><ul>
787 <li>
789 <em>no</em> - Show no untracked files
790 </p>
791 </li>
792 <li>
794 <em>normal</em> - Shows untracked files and directories
795 </p>
796 </li>
797 <li>
799 <em>all</em> - Also shows individual files in untracked directories.
800 </p>
801 <div class="paragraph"><p>The default can be changed using the status.showUntrackedFiles
802 configuration variable documented in <a href="git-config.html">git-config(1)</a>.</p></div>
803 </li>
804 </ul></div>
805 </dd>
806 <dt class="hdlist1">
808 </dt>
809 <dt class="hdlist1">
810 --verbose
811 </dt>
812 <dd>
814 Show unified diff between the HEAD commit and what
815 would be committed at the bottom of the commit message
816 template. Note that this diff output doesn&#8217;t have its
817 lines prefixed with <em>#</em>.
818 </p>
819 </dd>
820 <dt class="hdlist1">
822 </dt>
823 <dt class="hdlist1">
824 --quiet
825 </dt>
826 <dd>
828 Suppress commit summary message.
829 </p>
830 </dd>
831 <dt class="hdlist1">
832 --dry-run
833 </dt>
834 <dd>
836 Do not create a commit, but show a list of paths that are
837 to be committed, paths with local changes that will be left
838 uncommitted and paths that are untracked.
839 </p>
840 </dd>
841 <dt class="hdlist1">
842 --status
843 </dt>
844 <dd>
846 Include the output of <a href="git-status.html">git-status(1)</a> in the commit
847 message template when using an editor to prepare the commit
848 message. Defaults to on, but can be used to override
849 configuration variable commit.status.
850 </p>
851 </dd>
852 <dt class="hdlist1">
853 --no-status
854 </dt>
855 <dd>
857 Do not include the output of <a href="git-status.html">git-status(1)</a> in the
858 commit message template when using an editor to prepare the
859 default commit message.
860 </p>
861 </dd>
862 <dt class="hdlist1">
864 </dt>
865 <dd>
867 Do not interpret any more arguments as options.
868 </p>
869 </dd>
870 <dt class="hdlist1">
871 &lt;file&gt;&#8230;
872 </dt>
873 <dd>
875 When files are given on the command line, the command
876 commits the contents of the named files, without
877 recording the changes already staged. The contents of
878 these files are also staged for the next commit on top
879 of what have been staged before.
880 </p>
881 </dd>
882 </dl></div>
883 </div>
884 <h2 id="_date_formats">DATE FORMATS</h2>
885 <div class="sectionbody">
886 <div class="paragraph"><p>The GIT_AUTHOR_DATE, GIT_COMMITTER_DATE environment variables
887 and the <tt>--date</tt> option
888 support the following date formats:</p></div>
889 <div class="dlist"><dl>
890 <dt class="hdlist1">
891 Git internal format
892 </dt>
893 <dd>
895 It is <tt>&lt;unix timestamp&gt; &lt;timezone offset&gt;</tt>, where <tt>&lt;unix
896 timestamp&gt;</tt> is the number of seconds since the UNIX epoch.
897 <tt>&lt;timezone offset&gt;</tt> is a positive or negative offset from UTC.
898 For example CET (which is 2 hours ahead UTC) is <tt>+0200</tt>.
899 </p>
900 </dd>
901 <dt class="hdlist1">
902 RFC 2822
903 </dt>
904 <dd>
906 The standard email format as described by RFC 2822, for example
907 <tt>Thu, 07 Apr 2005 22:13:13 +0200</tt>.
908 </p>
909 </dd>
910 <dt class="hdlist1">
911 ISO 8601
912 </dt>
913 <dd>
915 Time and date specified by the ISO 8601 standard, for example
916 <tt>2005-04-07T22:13:13</tt>. The parser accepts a space instead of the
917 <tt>T</tt> character as well.
918 </p>
919 <div class="admonitionblock">
920 <table><tr>
921 <td class="icon">
922 <div class="title">Note</div>
923 </td>
924 <td class="content">In addition, the date part is accepted in the following formats:
925 <tt>YYYY.MM.DD</tt>, <tt>MM/DD/YYYY</tt> and <tt>DD.MM.YYYY</tt>.</td>
926 </tr></table>
927 </div>
928 </dd>
929 </dl></div>
930 </div>
931 <h2 id="_examples">EXAMPLES</h2>
932 <div class="sectionbody">
933 <div class="paragraph"><p>When recording your own work, the contents of modified files in
934 your working tree are temporarily stored to a staging area
935 called the "index" with <em>git add</em>. A file can be
936 reverted back, only in the index but not in the working tree,
937 to that of the last commit with <tt>git reset HEAD&#8201;&#8212;&#8201;&lt;file&gt;</tt>,
938 which effectively reverts <em>git add</em> and prevents the changes to
939 this file from participating in the next commit. After building
940 the state to be committed incrementally with these commands,
941 <tt>git commit</tt> (without any pathname parameter) is used to record what
942 has been staged so far. This is the most basic form of the
943 command. An example:</p></div>
944 <div class="listingblock">
945 <div class="content">
946 <pre><tt>$ edit hello.c
947 $ git rm goodbye.c
948 $ git add hello.c
949 $ git commit</tt></pre>
950 </div></div>
951 <div class="paragraph"><p>Instead of staging files after each individual change, you can
952 tell <tt>git commit</tt> to notice the changes to the files whose
953 contents are tracked in
954 your working tree and do corresponding <tt>git add</tt> and <tt>git rm</tt>
955 for you. That is, this example does the same as the earlier
956 example if there is no other change in your working tree:</p></div>
957 <div class="listingblock">
958 <div class="content">
959 <pre><tt>$ edit hello.c
960 $ rm goodbye.c
961 $ git commit -a</tt></pre>
962 </div></div>
963 <div class="paragraph"><p>The command <tt>git commit -a</tt> first looks at your working tree,
964 notices that you have modified hello.c and removed goodbye.c,
965 and performs necessary <tt>git add</tt> and <tt>git rm</tt> for you.</p></div>
966 <div class="paragraph"><p>After staging changes to many files, you can alter the order the
967 changes are recorded in, by giving pathnames to <tt>git commit</tt>.
968 When pathnames are given, the command makes a commit that
969 only records the changes made to the named paths:</p></div>
970 <div class="listingblock">
971 <div class="content">
972 <pre><tt>$ edit hello.c hello.h
973 $ git add hello.c hello.h
974 $ edit Makefile
975 $ git commit Makefile</tt></pre>
976 </div></div>
977 <div class="paragraph"><p>This makes a commit that records the modification to <tt>Makefile</tt>.
978 The changes staged for <tt>hello.c</tt> and <tt>hello.h</tt> are not included
979 in the resulting commit. However, their changes are not lost&#8201;&#8212;&#8201;they are still staged and merely held back. After the above
980 sequence, if you do:</p></div>
981 <div class="listingblock">
982 <div class="content">
983 <pre><tt>$ git commit</tt></pre>
984 </div></div>
985 <div class="paragraph"><p>this second commit would record the changes to <tt>hello.c</tt> and
986 <tt>hello.h</tt> as expected.</p></div>
987 <div class="paragraph"><p>After a merge (initiated by <em>git merge</em> or <em>git pull</em>) stops
988 because of conflicts, cleanly merged
989 paths are already staged to be committed for you, and paths that
990 conflicted are left in unmerged state. You would have to first
991 check which paths are conflicting with <em>git status</em>
992 and after fixing them manually in your working tree, you would
993 stage the result as usual with <em>git add</em>:</p></div>
994 <div class="listingblock">
995 <div class="content">
996 <pre><tt>$ git status | grep unmerged
997 unmerged: hello.c
998 $ edit hello.c
999 $ git add hello.c</tt></pre>
1000 </div></div>
1001 <div class="paragraph"><p>After resolving conflicts and staging the result, <tt>git ls-files -u</tt>
1002 would stop mentioning the conflicted path. When you are done,
1003 run <tt>git commit</tt> to finally record the merge:</p></div>
1004 <div class="listingblock">
1005 <div class="content">
1006 <pre><tt>$ git commit</tt></pre>
1007 </div></div>
1008 <div class="paragraph"><p>As with the case to record your own changes, you can use <tt>-a</tt>
1009 option to save typing. One difference is that during a merge
1010 resolution, you cannot use <tt>git commit</tt> with pathnames to
1011 alter the order the changes are committed, because the merge
1012 should be recorded as a single commit. In fact, the command
1013 refuses to run when given pathnames (but see <tt>-i</tt> option).</p></div>
1014 </div>
1015 <h2 id="_discussion">DISCUSSION</h2>
1016 <div class="sectionbody">
1017 <div class="paragraph"><p>Though not required, it&#8217;s a good idea to begin the commit message
1018 with a single short (less than 50 character) line summarizing the
1019 change, followed by a blank line and then a more thorough description.
1020 Tools that turn commits into email, for example, use the first line
1021 on the Subject: line and the rest of the commit in the body.</p></div>
1022 <div class="paragraph"><p>At the core level, git is character encoding agnostic.</p></div>
1023 <div class="ulist"><ul>
1024 <li>
1026 The pathnames recorded in the index and in the tree objects
1027 are treated as uninterpreted sequences of non-NUL bytes.
1028 What readdir(2) returns are what are recorded and compared
1029 with the data git keeps track of, which in turn are expected
1030 to be what lstat(2) and creat(2) accepts. There is no such
1031 thing as pathname encoding translation.
1032 </p>
1033 </li>
1034 <li>
1036 The contents of the blob objects are uninterpreted sequences
1037 of bytes. There is no encoding translation at the core
1038 level.
1039 </p>
1040 </li>
1041 <li>
1043 The commit log messages are uninterpreted sequences of non-NUL
1044 bytes.
1045 </p>
1046 </li>
1047 </ul></div>
1048 <div class="paragraph"><p>Although we encourage that the commit log messages are encoded
1049 in UTF-8, both the core and git Porcelain are designed not to
1050 force UTF-8 on projects. If all participants of a particular
1051 project find it more convenient to use legacy encodings, git
1052 does not forbid it. However, there are a few things to keep in
1053 mind.</p></div>
1054 <div class="olist arabic"><ol class="arabic">
1055 <li>
1057 <em>git commit</em> and <em>git commit-tree</em> issues
1058 a warning if the commit log message given to it does not look
1059 like a valid UTF-8 string, unless you explicitly say your
1060 project uses a legacy encoding. The way to say this is to
1061 have i18n.commitencoding in <tt>.git/config</tt> file, like this:
1062 </p>
1063 <div class="listingblock">
1064 <div class="content">
1065 <pre><tt>[i18n]
1066 commitencoding = ISO-8859-1</tt></pre>
1067 </div></div>
1068 <div class="paragraph"><p>Commit objects created with the above setting record the value
1069 of <tt>i18n.commitencoding</tt> in its <tt>encoding</tt> header. This is to
1070 help other people who look at them later. Lack of this header
1071 implies that the commit log message is encoded in UTF-8.</p></div>
1072 </li>
1073 <li>
1075 <em>git log</em>, <em>git show</em>, <em>git blame</em> and friends look at the
1076 <tt>encoding</tt> header of a commit object, and try to re-code the
1077 log message into UTF-8 unless otherwise specified. You can
1078 specify the desired output encoding with
1079 <tt>i18n.logoutputencoding</tt> in <tt>.git/config</tt> file, like this:
1080 </p>
1081 <div class="listingblock">
1082 <div class="content">
1083 <pre><tt>[i18n]
1084 logoutputencoding = ISO-8859-1</tt></pre>
1085 </div></div>
1086 <div class="paragraph"><p>If you do not have this configuration variable, the value of
1087 <tt>i18n.commitencoding</tt> is used instead.</p></div>
1088 </li>
1089 </ol></div>
1090 <div class="paragraph"><p>Note that we deliberately chose not to re-code the commit log
1091 message when a commit is made to force UTF-8 at the commit
1092 object level, because re-coding to UTF-8 is not necessarily a
1093 reversible operation.</p></div>
1094 </div>
1095 <h2 id="_environment_and_configuration_variables">ENVIRONMENT AND CONFIGURATION VARIABLES</h2>
1096 <div class="sectionbody">
1097 <div class="paragraph"><p>The editor used to edit the commit log message will be chosen from the
1098 GIT_EDITOR environment variable, the core.editor configuration variable, the
1099 VISUAL environment variable, or the EDITOR environment variable (in that
1100 order). See <a href="git-var.html">git-var(1)</a> for details.</p></div>
1101 </div>
1102 <h2 id="_hooks">HOOKS</h2>
1103 <div class="sectionbody">
1104 <div class="paragraph"><p>This command can run <tt>commit-msg</tt>, <tt>prepare-commit-msg</tt>, <tt>pre-commit</tt>,
1105 and <tt>post-commit</tt> hooks. See <a href="githooks.html">githooks(5)</a> for more
1106 information.</p></div>
1107 </div>
1108 <h2 id="_see_also">SEE ALSO</h2>
1109 <div class="sectionbody">
1110 <div class="paragraph"><p><a href="git-add.html">git-add(1)</a>,
1111 <a href="git-rm.html">git-rm(1)</a>,
1112 <a href="git-mv.html">git-mv(1)</a>,
1113 <a href="git-merge.html">git-merge(1)</a>,
1114 <a href="git-commit-tree.html">git-commit-tree(1)</a></p></div>
1115 </div>
1116 <h2 id="_git">GIT</h2>
1117 <div class="sectionbody">
1118 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
1119 </div>
1120 <div id="footer">
1121 <div id="footer-text">
1122 Last updated 2011-03-15 23:30:13 UTC
1123 </div>
1124 </div>
1125 </body>
1126 </html>