Autogenerated HTML docs for v1.7.6-rc1
[git/jnareb-git.git] / git-commit.html
blobe44f20528ff0d9cd3cd8d3a010871dd9065c085a
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 | --patch] [-s] [-v] [-u&lt;mode&gt;] [--amend]
419 [--dry-run] [(-c | -C | --fixup | --squash) &lt;commit&gt;]
420 [-F &lt;file&gt; | -m &lt;msg&gt;] [--reset-author] [--allow-empty]
421 [--allow-empty-message] [--no-verify] [-e] [--author=&lt;author&gt;]
422 [--date=&lt;date&gt;] [--cleanup=&lt;mode&gt;] [--status | --no-status]
423 [-i | -o] [--] [&lt;file&gt;&#8230;]</div>
424 <div class="verseblock-attribution">
425 </div></div>
426 </div>
427 <h2 id="_description">DESCRIPTION</h2>
428 <div class="sectionbody">
429 <div class="paragraph"><p>Stores the current contents of the index in a new commit along
430 with a log message from the user describing the changes.</p></div>
431 <div class="paragraph"><p>The content to be added can be specified in several ways:</p></div>
432 <div class="olist arabic"><ol class="arabic">
433 <li>
435 by using <em>git add</em> to incrementally "add" changes to the
436 index before using the <em>commit</em> command (Note: even modified
437 files must be "added");
438 </p>
439 </li>
440 <li>
442 by using <em>git rm</em> to remove files from the working tree
443 and the index, again before using the <em>commit</em> command;
444 </p>
445 </li>
446 <li>
448 by listing files as arguments to the <em>commit</em> command, in which
449 case the commit will ignore changes staged in the index, and instead
450 record the current content of the listed files (which must already
451 be known to git);
452 </p>
453 </li>
454 <li>
456 by using the -a switch with the <em>commit</em> command to automatically
457 "add" changes from all known files (i.e. all files that are already
458 listed in the index) and to automatically "rm" files in the index
459 that have been removed from the working tree, and then perform the
460 actual commit;
461 </p>
462 </li>
463 <li>
465 by using the --interactive or --patch switches with the <em>commit</em> command
466 to decide one by one which files or hunks should be part of the commit,
467 before finalizing the operation. See the <tt>`Interactive Mode</tt>` section of
468 <a href="git-add.html">git-add(1)</a> to learn how to operate these modes.
469 </p>
470 </li>
471 </ol></div>
472 <div class="paragraph"><p>The <tt>--dry-run</tt> option can be used to obtain a
473 summary of what is included by any of the above for the next
474 commit by giving the same set of parameters (options and paths).</p></div>
475 <div class="paragraph"><p>If you make a commit and then find a mistake immediately after
476 that, you can recover from it with <em>git reset</em>.</p></div>
477 </div>
478 <h2 id="_options">OPTIONS</h2>
479 <div class="sectionbody">
480 <div class="dlist"><dl>
481 <dt class="hdlist1">
483 </dt>
484 <dt class="hdlist1">
485 --all
486 </dt>
487 <dd>
489 Tell the command to automatically stage files that have
490 been modified and deleted, but new files you have not
491 told git about are not affected.
492 </p>
493 </dd>
494 <dt class="hdlist1">
496 </dt>
497 <dt class="hdlist1">
498 --patch
499 </dt>
500 <dd>
502 Use the interactive patch selection interface to chose
503 which changes to commit. See <a href="git-add.html">git-add(1)</a> for
504 details.
505 </p>
506 </dd>
507 <dt class="hdlist1">
508 -C &lt;commit&gt;
509 </dt>
510 <dt class="hdlist1">
511 --reuse-message=&lt;commit&gt;
512 </dt>
513 <dd>
515 Take an existing commit object, and reuse the log message
516 and the authorship information (including the timestamp)
517 when creating the commit.
518 </p>
519 </dd>
520 <dt class="hdlist1">
521 -c &lt;commit&gt;
522 </dt>
523 <dt class="hdlist1">
524 --reedit-message=&lt;commit&gt;
525 </dt>
526 <dd>
528 Like <em>-C</em>, but with <em>-c</em> the editor is invoked, so that
529 the user can further edit the commit message.
530 </p>
531 </dd>
532 <dt class="hdlist1">
533 --fixup=&lt;commit&gt;
534 </dt>
535 <dd>
537 Construct a commit message for use with <tt>rebase --autosquash</tt>.
538 The commit message will be the subject line from the specified
539 commit with a prefix of "fixup! ". See <a href="git-rebase.html">git-rebase(1)</a>
540 for details.
541 </p>
542 </dd>
543 <dt class="hdlist1">
544 --squash=&lt;commit&gt;
545 </dt>
546 <dd>
548 Construct a commit message for use with <tt>rebase --autosquash</tt>.
549 The commit message subject line is taken from the specified
550 commit with a prefix of "squash! ". Can be used with additional
551 commit message options (<tt>-m</tt>/<tt>-c</tt>/<tt>-C</tt>/<tt>-F</tt>). See
552 <a href="git-rebase.html">git-rebase(1)</a> for details.
553 </p>
554 </dd>
555 <dt class="hdlist1">
556 --reset-author
557 </dt>
558 <dd>
560 When used with -C/-c/--amend options, or when committing after a
561 a conflicting cherry-pick, declare that the authorship of the
562 resulting commit now belongs of the committer. This also renews
563 the author timestamp.
564 </p>
565 </dd>
566 <dt class="hdlist1">
567 --short
568 </dt>
569 <dd>
571 When doing a dry-run, give the output in the short-format. See
572 <a href="git-status.html">git-status(1)</a> for details. Implies <tt>--dry-run</tt>.
573 </p>
574 </dd>
575 <dt class="hdlist1">
576 --porcelain
577 </dt>
578 <dd>
580 When doing a dry-run, give the output in a porcelain-ready
581 format. See <a href="git-status.html">git-status(1)</a> for details. Implies
582 <tt>--dry-run</tt>.
583 </p>
584 </dd>
585 <dt class="hdlist1">
587 </dt>
588 <dd>
590 When showing <tt>short</tt> or <tt>porcelain</tt> status output, terminate
591 entries in the status output with NUL, instead of LF. If no
592 format is given, implies the <tt>--porcelain</tt> output format.
593 </p>
594 </dd>
595 <dt class="hdlist1">
596 -F &lt;file&gt;
597 </dt>
598 <dt class="hdlist1">
599 --file=&lt;file&gt;
600 </dt>
601 <dd>
603 Take the commit message from the given file. Use <em>-</em> to
604 read the message from the standard input.
605 </p>
606 </dd>
607 <dt class="hdlist1">
608 --author=&lt;author&gt;
609 </dt>
610 <dd>
612 Override the commit author. Specify an explicit author using the
613 standard <tt>A U Thor &lt;<a href="mailto:author@example.com">author@example.com</a>&gt;</tt> format. Otherwise &lt;author&gt;
614 is assumed to be a pattern and is used to search for an existing
615 commit by that author (i.e. rev-list --all -i --author=&lt;author&gt;);
616 the commit author is then copied from the first such commit found.
617 </p>
618 </dd>
619 <dt class="hdlist1">
620 --date=&lt;date&gt;
621 </dt>
622 <dd>
624 Override the author date used in the commit.
625 </p>
626 </dd>
627 <dt class="hdlist1">
628 -m &lt;msg&gt;
629 </dt>
630 <dt class="hdlist1">
631 --message=&lt;msg&gt;
632 </dt>
633 <dd>
635 Use the given &lt;msg&gt; as the commit message.
636 </p>
637 </dd>
638 <dt class="hdlist1">
639 -t &lt;file&gt;
640 </dt>
641 <dt class="hdlist1">
642 --template=&lt;file&gt;
643 </dt>
644 <dd>
646 Use the contents of the given file as the initial version
647 of the commit message. The editor is invoked and you can
648 make subsequent changes. If a message is specified using
649 the <tt>-m</tt> or <tt>-F</tt> options, this option has no effect. This
650 overrides the <tt>commit.template</tt> configuration variable.
651 </p>
652 </dd>
653 <dt class="hdlist1">
655 </dt>
656 <dt class="hdlist1">
657 --signoff
658 </dt>
659 <dd>
661 Add Signed-off-by line by the committer at the end of the commit
662 log message.
663 </p>
664 </dd>
665 <dt class="hdlist1">
667 </dt>
668 <dt class="hdlist1">
669 --no-verify
670 </dt>
671 <dd>
673 This option bypasses the pre-commit and commit-msg hooks.
674 See also <a href="githooks.html">githooks(5)</a>.
675 </p>
676 </dd>
677 <dt class="hdlist1">
678 --allow-empty
679 </dt>
680 <dd>
682 Usually recording a commit that has the exact same tree as its
683 sole parent commit is a mistake, and the command prevents you
684 from making such a commit. This option bypasses the safety, and
685 is primarily for use by foreign SCM interface scripts.
686 </p>
687 </dd>
688 <dt class="hdlist1">
689 --allow-empty-message
690 </dt>
691 <dd>
693 Like --allow-empty this command is primarily for use by foreign
694 SCM interface scripts. It allows you to create a commit with an
695 empty commit message without using plumbing commands like
696 <a href="git-commit-tree.html">git-commit-tree(1)</a>.
697 </p>
698 </dd>
699 <dt class="hdlist1">
700 --cleanup=&lt;mode&gt;
701 </dt>
702 <dd>
704 This option sets how the commit message is cleaned up.
705 The <em>&lt;mode&gt;</em> can be one of <em>verbatim</em>, <em>whitespace</em>, <em>strip</em>,
706 and <em>default</em>. The <em>default</em> mode will strip leading and
707 trailing empty lines and #commentary from the commit message
708 only if the message is to be edited. Otherwise only whitespace
709 removed. The <em>verbatim</em> mode does not change message at all,
710 <em>whitespace</em> removes just leading/trailing whitespace lines
711 and <em>strip</em> removes both whitespace and commentary.
712 </p>
713 </dd>
714 <dt class="hdlist1">
716 </dt>
717 <dt class="hdlist1">
718 --edit
719 </dt>
720 <dd>
722 The message taken from file with <tt>-F</tt>, command line with
723 <tt>-m</tt>, and from file with <tt>-C</tt> are usually used as the
724 commit log message unmodified. This option lets you
725 further edit the message taken from these sources.
726 </p>
727 </dd>
728 <dt class="hdlist1">
729 --amend
730 </dt>
731 <dd>
733 Used to amend the tip of the current branch. Prepare the tree
734 object you would want to replace the latest commit as usual
735 (this includes the usual -i/-o and explicit paths), and the
736 commit log editor is seeded with the commit message from the
737 tip of the current branch. The commit you create replaces the
738 current tip&#8201;&#8212;&#8201;if it was a merge, it will have the parents of
739 the current tip as parents&#8201;&#8212;&#8201;so the current top commit is
740 discarded.
741 </p>
742 <div class="paragraph"><p>It is a rough equivalent for:</p></div>
743 <div class="listingblock">
744 <div class="content">
745 <pre><tt> $ git reset --soft HEAD^
746 $ ... do something else to come up with the right tree ...
747 $ git commit -c ORIG_HEAD</tt></pre>
748 </div></div>
749 <div class="paragraph"><p>but can be used to amend a merge commit.</p></div>
750 <div class="paragraph"><p>You should understand the implications of rewriting history if you
751 amend a commit that has already been published. (See the "RECOVERING
752 FROM UPSTREAM REBASE" section in <a href="git-rebase.html">git-rebase(1)</a>.)</p></div>
753 </dd>
754 <dt class="hdlist1">
756 </dt>
757 <dt class="hdlist1">
758 --include
759 </dt>
760 <dd>
762 Before making a commit out of staged contents so far,
763 stage the contents of paths given on the command line
764 as well. This is usually not what you want unless you
765 are concluding a conflicted merge.
766 </p>
767 </dd>
768 <dt class="hdlist1">
770 </dt>
771 <dt class="hdlist1">
772 --only
773 </dt>
774 <dd>
776 Make a commit only from the paths specified on the
777 command line, disregarding any contents that have been
778 staged so far. This is the default mode of operation of
779 <em>git commit</em> if any paths are given on the command line,
780 in which case this option can be omitted.
781 If this option is specified together with <em>--amend</em>, then
782 no paths need to be specified, which can be used to amend
783 the last commit without committing changes that have
784 already been staged.
785 </p>
786 </dd>
787 <dt class="hdlist1">
788 -u[&lt;mode&gt;]
789 </dt>
790 <dt class="hdlist1">
791 --untracked-files[=&lt;mode&gt;]
792 </dt>
793 <dd>
795 Show untracked files.
796 </p>
797 <div class="paragraph"><p>The mode parameter is optional (defaults to <em>all</em>), and is used to
798 specify the handling of untracked files; when -u is not used, the
799 default is <em>normal</em>, i.e. show untracked files and directories.</p></div>
800 <div class="paragraph"><p>The possible options are:</p></div>
801 <div class="ulist"><ul>
802 <li>
804 <em>no</em> - Show no untracked files
805 </p>
806 </li>
807 <li>
809 <em>normal</em> - Shows untracked files and directories
810 </p>
811 </li>
812 <li>
814 <em>all</em> - Also shows individual files in untracked directories.
815 </p>
816 <div class="paragraph"><p>The default can be changed using the status.showUntrackedFiles
817 configuration variable documented in <a href="git-config.html">git-config(1)</a>.</p></div>
818 </li>
819 </ul></div>
820 </dd>
821 <dt class="hdlist1">
823 </dt>
824 <dt class="hdlist1">
825 --verbose
826 </dt>
827 <dd>
829 Show unified diff between the HEAD commit and what
830 would be committed at the bottom of the commit message
831 template. Note that this diff output doesn&#8217;t have its
832 lines prefixed with <em>#</em>.
833 </p>
834 </dd>
835 <dt class="hdlist1">
837 </dt>
838 <dt class="hdlist1">
839 --quiet
840 </dt>
841 <dd>
843 Suppress commit summary message.
844 </p>
845 </dd>
846 <dt class="hdlist1">
847 --dry-run
848 </dt>
849 <dd>
851 Do not create a commit, but show a list of paths that are
852 to be committed, paths with local changes that will be left
853 uncommitted and paths that are untracked.
854 </p>
855 </dd>
856 <dt class="hdlist1">
857 --status
858 </dt>
859 <dd>
861 Include the output of <a href="git-status.html">git-status(1)</a> in the commit
862 message template when using an editor to prepare the commit
863 message. Defaults to on, but can be used to override
864 configuration variable commit.status.
865 </p>
866 </dd>
867 <dt class="hdlist1">
868 --no-status
869 </dt>
870 <dd>
872 Do not include the output of <a href="git-status.html">git-status(1)</a> in the
873 commit message template when using an editor to prepare the
874 default commit message.
875 </p>
876 </dd>
877 <dt class="hdlist1">
879 </dt>
880 <dd>
882 Do not interpret any more arguments as options.
883 </p>
884 </dd>
885 <dt class="hdlist1">
886 &lt;file&gt;&#8230;
887 </dt>
888 <dd>
890 When files are given on the command line, the command
891 commits the contents of the named files, without
892 recording the changes already staged. The contents of
893 these files are also staged for the next commit on top
894 of what have been staged before.
895 </p>
896 </dd>
897 </dl></div>
898 </div>
899 <h2 id="_date_formats">DATE FORMATS</h2>
900 <div class="sectionbody">
901 <div class="paragraph"><p>The GIT_AUTHOR_DATE, GIT_COMMITTER_DATE environment variables
902 and the <tt>--date</tt> option
903 support the following date formats:</p></div>
904 <div class="dlist"><dl>
905 <dt class="hdlist1">
906 Git internal format
907 </dt>
908 <dd>
910 It is <tt>&lt;unix timestamp&gt; &lt;timezone offset&gt;</tt>, where <tt>&lt;unix
911 timestamp&gt;</tt> is the number of seconds since the UNIX epoch.
912 <tt>&lt;timezone offset&gt;</tt> is a positive or negative offset from UTC.
913 For example CET (which is 2 hours ahead UTC) is <tt>+0200</tt>.
914 </p>
915 </dd>
916 <dt class="hdlist1">
917 RFC 2822
918 </dt>
919 <dd>
921 The standard email format as described by RFC 2822, for example
922 <tt>Thu, 07 Apr 2005 22:13:13 +0200</tt>.
923 </p>
924 </dd>
925 <dt class="hdlist1">
926 ISO 8601
927 </dt>
928 <dd>
930 Time and date specified by the ISO 8601 standard, for example
931 <tt>2005-04-07T22:13:13</tt>. The parser accepts a space instead of the
932 <tt>T</tt> character as well.
933 </p>
934 <div class="admonitionblock">
935 <table><tr>
936 <td class="icon">
937 <div class="title">Note</div>
938 </td>
939 <td class="content">In addition, the date part is accepted in the following formats:
940 <tt>YYYY.MM.DD</tt>, <tt>MM/DD/YYYY</tt> and <tt>DD.MM.YYYY</tt>.</td>
941 </tr></table>
942 </div>
943 </dd>
944 </dl></div>
945 </div>
946 <h2 id="_examples">EXAMPLES</h2>
947 <div class="sectionbody">
948 <div class="paragraph"><p>When recording your own work, the contents of modified files in
949 your working tree are temporarily stored to a staging area
950 called the "index" with <em>git add</em>. A file can be
951 reverted back, only in the index but not in the working tree,
952 to that of the last commit with <tt>git reset HEAD&#8201;&#8212;&#8201;&lt;file&gt;</tt>,
953 which effectively reverts <em>git add</em> and prevents the changes to
954 this file from participating in the next commit. After building
955 the state to be committed incrementally with these commands,
956 <tt>git commit</tt> (without any pathname parameter) is used to record what
957 has been staged so far. This is the most basic form of the
958 command. An example:</p></div>
959 <div class="listingblock">
960 <div class="content">
961 <pre><tt>$ edit hello.c
962 $ git rm goodbye.c
963 $ git add hello.c
964 $ git commit</tt></pre>
965 </div></div>
966 <div class="paragraph"><p>Instead of staging files after each individual change, you can
967 tell <tt>git commit</tt> to notice the changes to the files whose
968 contents are tracked in
969 your working tree and do corresponding <tt>git add</tt> and <tt>git rm</tt>
970 for you. That is, this example does the same as the earlier
971 example if there is no other change in your working tree:</p></div>
972 <div class="listingblock">
973 <div class="content">
974 <pre><tt>$ edit hello.c
975 $ rm goodbye.c
976 $ git commit -a</tt></pre>
977 </div></div>
978 <div class="paragraph"><p>The command <tt>git commit -a</tt> first looks at your working tree,
979 notices that you have modified hello.c and removed goodbye.c,
980 and performs necessary <tt>git add</tt> and <tt>git rm</tt> for you.</p></div>
981 <div class="paragraph"><p>After staging changes to many files, you can alter the order the
982 changes are recorded in, by giving pathnames to <tt>git commit</tt>.
983 When pathnames are given, the command makes a commit that
984 only records the changes made to the named paths:</p></div>
985 <div class="listingblock">
986 <div class="content">
987 <pre><tt>$ edit hello.c hello.h
988 $ git add hello.c hello.h
989 $ edit Makefile
990 $ git commit Makefile</tt></pre>
991 </div></div>
992 <div class="paragraph"><p>This makes a commit that records the modification to <tt>Makefile</tt>.
993 The changes staged for <tt>hello.c</tt> and <tt>hello.h</tt> are not included
994 in the resulting commit. However, their changes are not lost&#8201;&#8212;&#8201;they are still staged and merely held back. After the above
995 sequence, if you do:</p></div>
996 <div class="listingblock">
997 <div class="content">
998 <pre><tt>$ git commit</tt></pre>
999 </div></div>
1000 <div class="paragraph"><p>this second commit would record the changes to <tt>hello.c</tt> and
1001 <tt>hello.h</tt> as expected.</p></div>
1002 <div class="paragraph"><p>After a merge (initiated by <em>git merge</em> or <em>git pull</em>) stops
1003 because of conflicts, cleanly merged
1004 paths are already staged to be committed for you, and paths that
1005 conflicted are left in unmerged state. You would have to first
1006 check which paths are conflicting with <em>git status</em>
1007 and after fixing them manually in your working tree, you would
1008 stage the result as usual with <em>git add</em>:</p></div>
1009 <div class="listingblock">
1010 <div class="content">
1011 <pre><tt>$ git status | grep unmerged
1012 unmerged: hello.c
1013 $ edit hello.c
1014 $ git add hello.c</tt></pre>
1015 </div></div>
1016 <div class="paragraph"><p>After resolving conflicts and staging the result, <tt>git ls-files -u</tt>
1017 would stop mentioning the conflicted path. When you are done,
1018 run <tt>git commit</tt> to finally record the merge:</p></div>
1019 <div class="listingblock">
1020 <div class="content">
1021 <pre><tt>$ git commit</tt></pre>
1022 </div></div>
1023 <div class="paragraph"><p>As with the case to record your own changes, you can use <tt>-a</tt>
1024 option to save typing. One difference is that during a merge
1025 resolution, you cannot use <tt>git commit</tt> with pathnames to
1026 alter the order the changes are committed, because the merge
1027 should be recorded as a single commit. In fact, the command
1028 refuses to run when given pathnames (but see <tt>-i</tt> option).</p></div>
1029 </div>
1030 <h2 id="_discussion">DISCUSSION</h2>
1031 <div class="sectionbody">
1032 <div class="paragraph"><p>Though not required, it&#8217;s a good idea to begin the commit message
1033 with a single short (less than 50 character) line summarizing the
1034 change, followed by a blank line and then a more thorough description.
1035 Tools that turn commits into email, for example, use the first line
1036 on the Subject: line and the rest of the commit in the body.</p></div>
1037 <div class="paragraph"><p>At the core level, git is character encoding agnostic.</p></div>
1038 <div class="ulist"><ul>
1039 <li>
1041 The pathnames recorded in the index and in the tree objects
1042 are treated as uninterpreted sequences of non-NUL bytes.
1043 What readdir(2) returns are what are recorded and compared
1044 with the data git keeps track of, which in turn are expected
1045 to be what lstat(2) and creat(2) accepts. There is no such
1046 thing as pathname encoding translation.
1047 </p>
1048 </li>
1049 <li>
1051 The contents of the blob objects are uninterpreted sequences
1052 of bytes. There is no encoding translation at the core
1053 level.
1054 </p>
1055 </li>
1056 <li>
1058 The commit log messages are uninterpreted sequences of non-NUL
1059 bytes.
1060 </p>
1061 </li>
1062 </ul></div>
1063 <div class="paragraph"><p>Although we encourage that the commit log messages are encoded
1064 in UTF-8, both the core and git Porcelain are designed not to
1065 force UTF-8 on projects. If all participants of a particular
1066 project find it more convenient to use legacy encodings, git
1067 does not forbid it. However, there are a few things to keep in
1068 mind.</p></div>
1069 <div class="olist arabic"><ol class="arabic">
1070 <li>
1072 <em>git commit</em> and <em>git commit-tree</em> issues
1073 a warning if the commit log message given to it does not look
1074 like a valid UTF-8 string, unless you explicitly say your
1075 project uses a legacy encoding. The way to say this is to
1076 have i18n.commitencoding in <tt>.git/config</tt> file, like this:
1077 </p>
1078 <div class="listingblock">
1079 <div class="content">
1080 <pre><tt>[i18n]
1081 commitencoding = ISO-8859-1</tt></pre>
1082 </div></div>
1083 <div class="paragraph"><p>Commit objects created with the above setting record the value
1084 of <tt>i18n.commitencoding</tt> in its <tt>encoding</tt> header. This is to
1085 help other people who look at them later. Lack of this header
1086 implies that the commit log message is encoded in UTF-8.</p></div>
1087 </li>
1088 <li>
1090 <em>git log</em>, <em>git show</em>, <em>git blame</em> and friends look at the
1091 <tt>encoding</tt> header of a commit object, and try to re-code the
1092 log message into UTF-8 unless otherwise specified. You can
1093 specify the desired output encoding with
1094 <tt>i18n.logoutputencoding</tt> in <tt>.git/config</tt> file, like this:
1095 </p>
1096 <div class="listingblock">
1097 <div class="content">
1098 <pre><tt>[i18n]
1099 logoutputencoding = ISO-8859-1</tt></pre>
1100 </div></div>
1101 <div class="paragraph"><p>If you do not have this configuration variable, the value of
1102 <tt>i18n.commitencoding</tt> is used instead.</p></div>
1103 </li>
1104 </ol></div>
1105 <div class="paragraph"><p>Note that we deliberately chose not to re-code the commit log
1106 message when a commit is made to force UTF-8 at the commit
1107 object level, because re-coding to UTF-8 is not necessarily a
1108 reversible operation.</p></div>
1109 </div>
1110 <h2 id="_environment_and_configuration_variables">ENVIRONMENT AND CONFIGURATION VARIABLES</h2>
1111 <div class="sectionbody">
1112 <div class="paragraph"><p>The editor used to edit the commit log message will be chosen from the
1113 GIT_EDITOR environment variable, the core.editor configuration variable, the
1114 VISUAL environment variable, or the EDITOR environment variable (in that
1115 order). See <a href="git-var.html">git-var(1)</a> for details.</p></div>
1116 </div>
1117 <h2 id="_hooks">HOOKS</h2>
1118 <div class="sectionbody">
1119 <div class="paragraph"><p>This command can run <tt>commit-msg</tt>, <tt>prepare-commit-msg</tt>, <tt>pre-commit</tt>,
1120 and <tt>post-commit</tt> hooks. See <a href="githooks.html">githooks(5)</a> for more
1121 information.</p></div>
1122 </div>
1123 <h2 id="_see_also">SEE ALSO</h2>
1124 <div class="sectionbody">
1125 <div class="paragraph"><p><a href="git-add.html">git-add(1)</a>,
1126 <a href="git-rm.html">git-rm(1)</a>,
1127 <a href="git-mv.html">git-mv(1)</a>,
1128 <a href="git-merge.html">git-merge(1)</a>,
1129 <a href="git-commit-tree.html">git-commit-tree(1)</a></p></div>
1130 </div>
1131 <h2 id="_git">GIT</h2>
1132 <div class="sectionbody">
1133 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
1134 </div>
1135 <div id="footer">
1136 <div id="footer-text">
1137 Last updated 2011-05-17 06:42:42 UTC
1138 </div>
1139 </div>
1140 </body>
1141 </html>