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">
5 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8" />
6 <meta name=
"generator" content=
"AsciiDoc 8.5.2" />
7 <title>git-commit(
1)
</title>
8 <style type=
"text/css">
10 p
, li
, dt
, dd
, div
, pre
, h1
, h2
, h3
, h4
, h5
, h6
{
12 border: 1px solid red;
17 margin: 1em 5% 1em 5%;
22 text-decoration: underline
;
42 h1
, h2
, h3
, h4
, h5
, h6
{
44 font-family: sans-serif
;
51 border-bottom: 2px solid silver
;
69 border: 1px solid silver
;
88 font-family: sans-serif
;
94 span#revnumber
, span#revdate
, span#revremark
{
95 font-family: sans-serif
;
99 font-family: sans-serif
;
101 border-top: 2px solid silver
;
107 padding-bottom: 0.5em;
111 padding-bottom: 0.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
{
122 margin-bottom: 1.5em;
124 div
.admonitionblock
{
126 margin-bottom: 2.0em;
131 div
.content
{ /* Block element content. */
135 /* Block element titles. */
136 div
.title
, caption
.title
{
138 font-family: sans-serif
;
142 margin-bottom: 0.5em;
148 td div
.title:first-child
{
151 div
.content div
.title:first-child
{
154 div
.content
+ div
.title
{
158 div
.sidebarblock
> div
.content
{
160 border: 1px solid silver
;
164 div
.listingblock
> div
.content
{
165 border: 1px solid silver
;
170 div
.quoteblock
, div
.verseblock
{
174 border-left: 5px solid
#dddddd;
178 div
.quoteblock
> div
.attribution
{
183 div
.verseblock
> div
.content
{
186 div
.verseblock
> div
.attribution
{
190 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
191 div
.verseblock
+ div
.attribution
{
195 div
.admonitionblock
.icon
{
199 text-decoration: underline
;
201 padding-right: 0.5em;
203 div
.admonitionblock td
.content
{
205 border-left: 3px solid
#dddddd;
208 div
.exampleblock
> div
.content
{
209 border-left: 3px solid
#dddddd;
213 div
.imageblock div
.content
{ padding-left: 0; }
214 span
.image img
{ border-style: none
; }
215 a
.image:visited
{ color: white
; }
219 margin-bottom: 0.8em;
232 list-style-position: outside
;
235 list-style-type: decimal
;
238 list-style-type: lower-alpha
;
241 list-style-type: upper-alpha
;
244 list-style-type: lower-roman
;
247 list-style-type: upper-roman
;
250 div
.compact ul
, div
.compact ol
,
251 div
.compact p
, div
.compact p
,
252 div
.compact div
, div
.compact div
{
254 margin-bottom: 0.1em;
257 div
.tableblock
> table
{
258 border: 3px solid
#527bbd;
260 thead
, p
.table
.header
{
261 font-family: sans-serif
;
273 /* Because the table frame attribute is overriden by CSS in most browsers. */
274 div
.tableblock
> table
[frame
="void"] {
277 div
.tableblock
> table
[frame
="hsides"] {
278 border-left-style: none
;
279 border-right-style: none
;
281 div
.tableblock
> table
[frame
="vsides"] {
282 border-top-style: none
;
283 border-bottom-style: none
;
289 margin-bottom: 0.8em;
292 padding-bottom: 15px;
294 dt
.hdlist1
.strong
, td
.hdlist1
.strong
{
300 padding-right: 0.8em;
306 div
.hdlist
.compact tr
{
315 .footnote, .footnoteref {
319 span
.footnote
, span
.footnoteref
{
320 vertical-align: super
;
324 margin: 20px 0 20px 0;
328 #footnotes div
.footnote
{
334 border-top: 1px solid silver
;
344 div#footer-badges
{ display: none
; }
348 margin-bottom: 2.5em;
353 font-family: sans-serif
;
357 margin-bottom: 0.1em;
360 div
.toclevel1
, div
.toclevel2
, div
.toclevel3
, div
.toclevel4
{
376 /* Overrides for manpage documents */
379 padding-bottom: 0.5em;
380 border-top: 2px solid silver
;
381 border-bottom: 2px solid silver
;
391 div#toc
{ display: none
; }
394 /* Workarounds for IE6's broken and incomplete CSS2. */
396 div
.sidebar-content
{
398 border: 1px solid silver
;
401 div
.sidebar-title
, div
.image-title
{
403 font-family: sans-serif
;
406 margin-bottom: 0.5em;
409 div
.listingblock div
.content
{
410 border: 1px solid silver
;
415 div
.quoteblock-attribution
{
420 div
.verseblock-content
{
423 div
.verseblock-attribution
{
428 div
.exampleblock-content
{
429 border-left: 3px solid
#dddddd;
433 /* IE6 sets dynamically generated links as visited. */
434 div#toc
a:visited
{ color: blue
; }
436 <script type=
"text/javascript">
438 window
.onload = function(){asciidoc
.footnotes();}
439 var asciidoc
= { // Namespace.
441 /////////////////////////////////////////////////////////////////////
442 // Table Of Contents generator
443 /////////////////////////////////////////////////////////////////////
445 /* Author: Mihai Bazon, September 2002
446 * http://students.infoiasi.ro/~mishoo
448 * Table Of Content generator
451 * Feel free to use this script under the terms of the GNU General Public
452 * License, as long as you do not remove or alter this notice.
455 /* modified by Troy D. Hanson, September 2006. License: GPL */
456 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
459 toc: function (toclevels
) {
461 function getText(el
) {
463 for (var i
= el
.firstChild
; i
!= null; i
= i
.nextSibling
) {
464 if (i
.nodeType
== 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
466 else if (i
.firstChild
!= null)
472 function TocEntry(el
, text
, toclevel
) {
475 this.toclevel
= toclevel
;
478 function tocEntries(el
, toclevels
) {
479 var result
= new Array
;
480 var re
= new RegExp('[hH]([2-'+(toclevels
+1)+'])');
481 // Function that scans the DOM tree for header elements (the DOM2
482 // nodeIterator API would be a better technique but not supported by all
484 var iterate = function (el
) {
485 for (var i
= el
.firstChild
; i
!= null; i
= i
.nextSibling
) {
486 if (i
.nodeType
== 1 /* Node.ELEMENT_NODE */) {
487 var mo
= re
.exec(i
.tagName
);
488 if (mo
&& (i
.getAttribute("class") || i
.getAttribute("className")) != "float") {
489 result
[result
.length
] = new TocEntry(i
, getText(i
), mo
[1]-1);
499 var toc
= document
.getElementById("toc");
500 var entries
= tocEntries(document
.getElementById("content"), toclevels
);
501 for (var i
= 0; i
< entries
.length
; ++i
) {
502 var entry
= entries
[i
];
503 if (entry
.element
.id
== "")
504 entry
.element
.id
= "_toc_" + i
;
505 var a
= document
.createElement("a");
506 a
.href
= "#" + entry
.element
.id
;
507 a
.appendChild(document
.createTextNode(entry
.text
));
508 var div
= document
.createElement("div");
510 div
.className
= "toclevel" + entry
.toclevel
;
511 toc
.appendChild(div
);
513 if (entries
.length
== 0)
514 toc
.parentNode
.removeChild(toc
);
518 /////////////////////////////////////////////////////////////////////
519 // Footnotes generator
520 /////////////////////////////////////////////////////////////////////
522 /* Based on footnote generation code from:
523 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
526 footnotes: function () {
527 var cont
= document
.getElementById("content");
528 var noteholder
= document
.getElementById("footnotes");
529 var spans
= cont
.getElementsByTagName("span");
532 for (i
=0; i
<spans
.length
; i
++) {
533 if (spans
[i
].className
== "footnote") {
535 // Use [\s\S] in place of . so multi-line matches work.
536 // Because JavaScript has no s (dotall) regex flag.
537 note
= spans
[i
].innerHTML
.match(/\s*\[([\s\S]*)]\s*/)[1];
538 noteholder
.innerHTML
+=
539 "<div class='footnote' id='_footnote_" + n
+ "'>" +
540 "<a href='#_footnoteref_" + n
+ "' title='Return to text'>" +
541 n
+ "</a>. " + note
+ "</div>";
543 "[<a id='_footnoteref_" + n
+ "' href='#_footnote_" + n
+
544 "' title='View footnote' class='footnote'>" + n
+ "</a>]";
545 var id
=spans
[i
].getAttribute("id");
546 if (id
!= null) refs
["#"+id
] = n
;
550 noteholder
.parentNode
.removeChild(noteholder
);
552 // Process footnoterefs.
553 for (i
=0; i
<spans
.length
; i
++) {
554 if (spans
[i
].className
== "footnoteref") {
555 var href
= spans
[i
].getElementsByTagName("a")[0].getAttribute("href");
556 href
= href
.match(/#.*/)[0]; // Because IE return full URL.
559 "[<a href='#_footnote_" + n
+
560 "' title='View footnote' class='footnote'>" + n
+ "</a>]";
573 git-commit(
1) Manual Page
576 <div class=
"sectionbody">
578 Record changes to the repository
583 <h2 id=
"_synopsis">SYNOPSIS
</h2>
584 <div class=
"sectionbody">
585 <div class=
"verseblock">
586 <div class=
"verseblock-content"><em>git commit
</em> [-a | --interactive | --patch] [-s] [-v] [-u
<mode
>] [--amend]
587 [--dry-run] [(-c | -C | --fixup | --squash)
<commit
>]
588 [-F
<file
> | -m
<msg
>] [--reset-author] [--allow-empty]
589 [--allow-empty-message] [--no-verify] [-e] [--author=
<author
>]
590 [--date=
<date
>] [--cleanup=
<mode
>] [--status | --no-status]
591 [-i | -o] [--] [
<file
>…]
</div>
592 <div class=
"verseblock-attribution">
595 <h2 id=
"_description">DESCRIPTION
</h2>
596 <div class=
"sectionbody">
597 <div class=
"paragraph"><p>Stores the current contents of the index in a new commit along
598 with a log message from the user describing the changes.
</p></div>
599 <div class=
"paragraph"><p>The content to be added can be specified in several ways:
</p></div>
600 <div class=
"olist arabic"><ol class=
"arabic">
603 by using
<em>git add
</em> to incrementally
"add" changes to the
604 index before using the
<em>commit
</em> command (Note: even modified
605 files must be
"added");
610 by using
<em>git rm
</em> to remove files from the working tree
611 and the index, again before using the
<em>commit
</em> command;
616 by listing files as arguments to the
<em>commit
</em> command, in which
617 case the commit will ignore changes staged in the index, and instead
618 record the current content of the listed files (which must already
624 by using the -a switch with the
<em>commit
</em> command to automatically
625 "add" changes from all known files (i.e. all files that are already
626 listed in the index) and to automatically
"rm" files in the index
627 that have been removed from the working tree, and then perform the
633 by using the --interactive or --patch switches with the
<em>commit
</em> command
634 to decide one by one which files or hunks should be part of the commit,
635 before finalizing the operation. See the
<tt>`Interactive Mode
</tt>` section of
636 <a href=
"git-add.html">git-add(
1)
</a> to learn how to operate these modes.
640 <div class=
"paragraph"><p>The
<tt>--dry-run
</tt> option can be used to obtain a
641 summary of what is included by any of the above for the next
642 commit by giving the same set of parameters (options and paths).
</p></div>
643 <div class=
"paragraph"><p>If you make a commit and then find a mistake immediately after
644 that, you can recover from it with
<em>git reset
</em>.
</p></div>
646 <h2 id=
"_options">OPTIONS
</h2>
647 <div class=
"sectionbody">
648 <div class=
"dlist"><dl>
657 Tell the command to automatically stage files that have
658 been modified and deleted, but new files you have not
659 told git about are not affected.
670 Use the interactive patch selection interface to chose
671 which changes to commit. See
<a href=
"git-add.html">git-add(
1)
</a> for
679 --reuse-message=
<commit
>
683 Take an existing commit object, and reuse the log message
684 and the authorship information (including the timestamp)
685 when creating the commit.
692 --reedit-message=
<commit
>
696 Like
<em>-C
</em>, but with
<em>-c
</em> the editor is invoked, so that
697 the user can further edit the commit message.
701 --fixup=
<commit
>
705 Construct a commit message for use with
<tt>rebase --autosquash
</tt>.
706 The commit message will be the subject line from the specified
707 commit with a prefix of
"fixup! ". See
<a href=
"git-rebase.html">git-rebase(
1)
</a>
712 --squash=
<commit
>
716 Construct a commit message for use with
<tt>rebase --autosquash
</tt>.
717 The commit message subject line is taken from the specified
718 commit with a prefix of
"squash! ". Can be used with additional
719 commit message options (
<tt>-m
</tt>/
<tt>-c
</tt>/
<tt>-C
</tt>/
<tt>-F
</tt>). See
720 <a href=
"git-rebase.html">git-rebase(
1)
</a> for details.
728 When used with -C/-c/--amend options, or when committing after a
729 a conflicting cherry-pick, declare that the authorship of the
730 resulting commit now belongs of the committer. This also renews
731 the author timestamp.
739 When doing a dry-run, give the output in the short-format. See
740 <a href=
"git-status.html">git-status(
1)
</a> for details. Implies
<tt>--dry-run
</tt>.
748 When doing a dry-run, give the output in a porcelain-ready
749 format. See
<a href=
"git-status.html">git-status(
1)
</a> for details. Implies
758 When showing
<tt>short
</tt> or
<tt>porcelain
</tt> status output, terminate
759 entries in the status output with NUL, instead of LF. If no
760 format is given, implies the
<tt>--porcelain
</tt> output format.
771 Take the commit message from the given file. Use
<em>-
</em> to
772 read the message from the standard input.
776 --author=
<author
>
780 Override the commit author. Specify an explicit author using the
781 standard
<tt>A U Thor
<<a href=
"mailto:author@example.com">author@example.com
</a>></tt> format. Otherwise
<author
>
782 is assumed to be a pattern and is used to search for an existing
783 commit by that author (i.e. rev-list --all -i --author=
<author
>);
784 the commit author is then copied from the first such commit found.
792 Override the author date used in the commit.
799 --message=
<msg
>
803 Use the given
<msg
> as the commit message.
810 --template=
<file
>
814 Use the contents of the given file as the initial version
815 of the commit message. The editor is invoked and you can
816 make subsequent changes. If a message is specified using
817 the
<tt>-m
</tt> or
<tt>-F
</tt> options, this option has no effect. This
818 overrides the
<tt>commit.template
</tt> configuration variable.
829 Add Signed-off-by line by the committer at the end of the commit
841 This option bypasses the pre-commit and commit-msg hooks.
842 See also
<a href=
"githooks.html">githooks(
5)
</a>.
850 Usually recording a commit that has the exact same tree as its
851 sole parent commit is a mistake, and the command prevents you
852 from making such a commit. This option bypasses the safety, and
853 is primarily for use by foreign SCM interface scripts.
857 --allow-empty-message
861 Like --allow-empty this command is primarily for use by foreign
862 SCM interface scripts. It allows you to create a commit with an
863 empty commit message without using plumbing commands like
864 <a href=
"git-commit-tree.html">git-commit-tree(
1)
</a>.
868 --cleanup=
<mode
>
872 This option sets how the commit message is cleaned up.
873 The
<em><mode
></em> can be one of
<em>verbatim
</em>,
<em>whitespace
</em>,
<em>strip
</em>,
874 and
<em>default
</em>. The
<em>default
</em> mode will strip leading and
875 trailing empty lines and #commentary from the commit message
876 only if the message is to be edited. Otherwise only whitespace
877 removed. The
<em>verbatim
</em> mode does not change message at all,
878 <em>whitespace
</em> removes just leading/trailing whitespace lines
879 and
<em>strip
</em> removes both whitespace and commentary.
890 The message taken from file with
<tt>-F
</tt>, command line with
891 <tt>-m
</tt>, and from file with
<tt>-C
</tt> are usually used as the
892 commit log message unmodified. This option lets you
893 further edit the message taken from these sources.
901 Used to amend the tip of the current branch. Prepare the tree
902 object you would want to replace the latest commit as usual
903 (this includes the usual -i/-o and explicit paths), and the
904 commit log editor is seeded with the commit message from the
905 tip of the current branch. The commit you create replaces the
906 current tip
 — if it was a merge, it will have the parents of
907 the current tip as parents
 — so the current top commit is
910 <div class=
"paragraph"><p>It is a rough equivalent for:
</p></div>
911 <div class=
"listingblock">
912 <div class=
"content">
913 <pre><tt> $ git reset --soft HEAD^
914 $ ... do something else to come up with the right tree ...
915 $ git commit -c ORIG_HEAD
</tt></pre>
917 <div class=
"paragraph"><p>but can be used to amend a merge commit.
</p></div>
918 <div class=
"paragraph"><p>You should understand the implications of rewriting history if you
919 amend a commit that has already been published. (See the
"RECOVERING
920 FROM UPSTREAM REBASE" section in
<a href=
"git-rebase.html">git-rebase(
1)
</a>.)
</p></div>
930 Before making a commit out of staged contents so far,
931 stage the contents of paths given on the command line
932 as well. This is usually not what you want unless you
933 are concluding a conflicted merge.
944 Make a commit only from the paths specified on the
945 command line, disregarding any contents that have been
946 staged so far. This is the default mode of operation of
947 <em>git commit
</em> if any paths are given on the command line,
948 in which case this option can be omitted.
949 If this option is specified together with
<em>--amend
</em>, then
950 no paths need to be specified, which can be used to amend
951 the last commit without committing changes that have
959 --untracked-files[=
<mode
>]
963 Show untracked files.
965 <div class=
"paragraph"><p>The mode parameter is optional (defaults to
<em>all
</em>), and is used to
966 specify the handling of untracked files; when -u is not used, the
967 default is
<em>normal
</em>, i.e. show untracked files and directories.
</p></div>
968 <div class=
"paragraph"><p>The possible options are:
</p></div>
969 <div class=
"ulist"><ul>
972 <em>no
</em> - Show no untracked files
977 <em>normal
</em> - Shows untracked files and directories
982 <em>all
</em> - Also shows individual files in untracked directories.
984 <div class=
"paragraph"><p>The default can be changed using the status.showUntrackedFiles
985 configuration variable documented in
<a href=
"git-config.html">git-config(
1)
</a>.
</p></div>
997 Show unified diff between the HEAD commit and what
998 would be committed at the bottom of the commit message
999 template. Note that this diff output doesn
’t have its
1000 lines prefixed with
<em>#
</em>.
1003 <dt class=
"hdlist1">
1006 <dt class=
"hdlist1">
1011 Suppress commit summary message.
1014 <dt class=
"hdlist1">
1019 Do not create a commit, but show a list of paths that are
1020 to be committed, paths with local changes that will be left
1021 uncommitted and paths that are untracked.
1024 <dt class=
"hdlist1">
1029 Include the output of
<a href=
"git-status.html">git-status(
1)
</a> in the commit
1030 message template when using an editor to prepare the commit
1031 message. Defaults to on, but can be used to override
1032 configuration variable commit.status.
1035 <dt class=
"hdlist1">
1040 Do not include the output of
<a href=
"git-status.html">git-status(
1)
</a> in the
1041 commit message template when using an editor to prepare the
1042 default commit message.
1045 <dt class=
"hdlist1">
1050 Do not interpret any more arguments as options.
1053 <dt class=
"hdlist1">
1058 When files are given on the command line, the command
1059 commits the contents of the named files, without
1060 recording the changes already staged. The contents of
1061 these files are also staged for the next commit on top
1062 of what have been staged before.
1067 <h2 id=
"_date_formats">DATE FORMATS
</h2>
1068 <div class=
"sectionbody">
1069 <div class=
"paragraph"><p>The GIT_AUTHOR_DATE, GIT_COMMITTER_DATE environment variables
1070 and the
<tt>--date
</tt> option
1071 support the following date formats:
</p></div>
1072 <div class=
"dlist"><dl>
1073 <dt class=
"hdlist1">
1078 It is
<tt><unix timestamp
> <timezone offset
></tt>, where
<tt><unix
1079 timestamp
></tt> is the number of seconds since the UNIX epoch.
1080 <tt><timezone offset
></tt> is a positive or negative offset from UTC.
1081 For example CET (which is
2 hours ahead UTC) is
<tt>+
0200</tt>.
1084 <dt class=
"hdlist1">
1089 The standard email format as described by RFC
2822, for example
1090 <tt>Thu,
07 Apr
2005 22:
13:
13 +
0200</tt>.
1093 <dt class=
"hdlist1">
1098 Time and date specified by the ISO
8601 standard, for example
1099 <tt>2005-
04-
07T22:
13:
13</tt>. The parser accepts a space instead of the
1100 <tt>T
</tt> character as well.
1102 <div class=
"admonitionblock">
1105 <div class=
"title">Note
</div>
1107 <td class=
"content">In addition, the date part is accepted in the following formats:
1108 <tt>YYYY.MM.DD
</tt>,
<tt>MM/DD/YYYY
</tt> and
<tt>DD.MM.YYYY
</tt>.
</td>
1114 <h2 id=
"_examples">EXAMPLES
</h2>
1115 <div class=
"sectionbody">
1116 <div class=
"paragraph"><p>When recording your own work, the contents of modified files in
1117 your working tree are temporarily stored to a staging area
1118 called the
"index" with
<em>git add
</em>. A file can be
1119 reverted back, only in the index but not in the working tree,
1120 to that of the last commit with
<tt>git reset HEAD --
<file
></tt>,
1121 which effectively reverts
<em>git add
</em> and prevents the changes to
1122 this file from participating in the next commit. After building
1123 the state to be committed incrementally with these commands,
1124 <tt>git commit
</tt> (without any pathname parameter) is used to record what
1125 has been staged so far. This is the most basic form of the
1126 command. An example:
</p></div>
1127 <div class=
"listingblock">
1128 <div class=
"content">
1129 <pre><tt>$ edit hello.c
1132 $ git commit
</tt></pre>
1134 <div class=
"paragraph"><p>Instead of staging files after each individual change, you can
1135 tell
<tt>git commit
</tt> to notice the changes to the files whose
1136 contents are tracked in
1137 your working tree and do corresponding
<tt>git add
</tt> and
<tt>git rm
</tt>
1138 for you. That is, this example does the same as the earlier
1139 example if there is no other change in your working tree:
</p></div>
1140 <div class=
"listingblock">
1141 <div class=
"content">
1142 <pre><tt>$ edit hello.c
1144 $ git commit -a
</tt></pre>
1146 <div class=
"paragraph"><p>The command
<tt>git commit -a
</tt> first looks at your working tree,
1147 notices that you have modified hello.c and removed goodbye.c,
1148 and performs necessary
<tt>git add
</tt> and
<tt>git rm
</tt> for you.
</p></div>
1149 <div class=
"paragraph"><p>After staging changes to many files, you can alter the order the
1150 changes are recorded in, by giving pathnames to
<tt>git commit
</tt>.
1151 When pathnames are given, the command makes a commit that
1152 only records the changes made to the named paths:
</p></div>
1153 <div class=
"listingblock">
1154 <div class=
"content">
1155 <pre><tt>$ edit hello.c hello.h
1156 $ git add hello.c hello.h
1158 $ git commit Makefile
</tt></pre>
1160 <div class=
"paragraph"><p>This makes a commit that records the modification to
<tt>Makefile
</tt>.
1161 The changes staged for
<tt>hello.c
</tt> and
<tt>hello.h
</tt> are not included
1162 in the resulting commit. However, their changes are not lost
 — they are still staged and merely held back. After the above
1163 sequence, if you do:
</p></div>
1164 <div class=
"listingblock">
1165 <div class=
"content">
1166 <pre><tt>$ git commit
</tt></pre>
1168 <div class=
"paragraph"><p>this second commit would record the changes to
<tt>hello.c
</tt> and
1169 <tt>hello.h
</tt> as expected.
</p></div>
1170 <div class=
"paragraph"><p>After a merge (initiated by
<em>git merge
</em> or
<em>git pull
</em>) stops
1171 because of conflicts, cleanly merged
1172 paths are already staged to be committed for you, and paths that
1173 conflicted are left in unmerged state. You would have to first
1174 check which paths are conflicting with
<em>git status
</em>
1175 and after fixing them manually in your working tree, you would
1176 stage the result as usual with
<em>git add
</em>:
</p></div>
1177 <div class=
"listingblock">
1178 <div class=
"content">
1179 <pre><tt>$ git status | grep unmerged
1182 $ git add hello.c
</tt></pre>
1184 <div class=
"paragraph"><p>After resolving conflicts and staging the result,
<tt>git ls-files -u
</tt>
1185 would stop mentioning the conflicted path. When you are done,
1186 run
<tt>git commit
</tt> to finally record the merge:
</p></div>
1187 <div class=
"listingblock">
1188 <div class=
"content">
1189 <pre><tt>$ git commit
</tt></pre>
1191 <div class=
"paragraph"><p>As with the case to record your own changes, you can use
<tt>-a
</tt>
1192 option to save typing. One difference is that during a merge
1193 resolution, you cannot use
<tt>git commit
</tt> with pathnames to
1194 alter the order the changes are committed, because the merge
1195 should be recorded as a single commit. In fact, the command
1196 refuses to run when given pathnames (but see
<tt>-i
</tt> option).
</p></div>
1198 <h2 id=
"_discussion">DISCUSSION
</h2>
1199 <div class=
"sectionbody">
1200 <div class=
"paragraph"><p>Though not required, it
’s a good idea to begin the commit message
1201 with a single short (less than
50 character) line summarizing the
1202 change, followed by a blank line and then a more thorough description.
1203 Tools that turn commits into email, for example, use the first line
1204 on the Subject: line and the rest of the commit in the body.
</p></div>
1205 <div class=
"paragraph"><p>At the core level, git is character encoding agnostic.
</p></div>
1206 <div class=
"ulist"><ul>
1209 The pathnames recorded in the index and in the tree objects
1210 are treated as uninterpreted sequences of non-NUL bytes.
1211 What readdir(
2) returns are what are recorded and compared
1212 with the data git keeps track of, which in turn are expected
1213 to be what lstat(
2) and creat(
2) accepts. There is no such
1214 thing as pathname encoding translation.
1219 The contents of the blob objects are uninterpreted sequences
1220 of bytes. There is no encoding translation at the core
1226 The commit log messages are uninterpreted sequences of non-NUL
1231 <div class=
"paragraph"><p>Although we encourage that the commit log messages are encoded
1232 in UTF-
8, both the core and git Porcelain are designed not to
1233 force UTF-
8 on projects. If all participants of a particular
1234 project find it more convenient to use legacy encodings, git
1235 does not forbid it. However, there are a few things to keep in
1237 <div class=
"olist arabic"><ol class=
"arabic">
1240 <em>git commit
</em> and
<em>git commit-tree
</em> issues
1241 a warning if the commit log message given to it does not look
1242 like a valid UTF-
8 string, unless you explicitly say your
1243 project uses a legacy encoding. The way to say this is to
1244 have i18n.commitencoding in
<tt>.git/config
</tt> file, like this:
1246 <div class=
"listingblock">
1247 <div class=
"content">
1249 commitencoding = ISO-
8859-
1</tt></pre>
1251 <div class=
"paragraph"><p>Commit objects created with the above setting record the value
1252 of
<tt>i18n.commitencoding
</tt> in its
<tt>encoding
</tt> header. This is to
1253 help other people who look at them later. Lack of this header
1254 implies that the commit log message is encoded in UTF-
8.
</p></div>
1258 <em>git log
</em>,
<em>git show
</em>,
<em>git blame
</em> and friends look at the
1259 <tt>encoding
</tt> header of a commit object, and try to re-code the
1260 log message into UTF-
8 unless otherwise specified. You can
1261 specify the desired output encoding with
1262 <tt>i18n.logoutputencoding
</tt> in
<tt>.git/config
</tt> file, like this:
1264 <div class=
"listingblock">
1265 <div class=
"content">
1267 logoutputencoding = ISO-
8859-
1</tt></pre>
1269 <div class=
"paragraph"><p>If you do not have this configuration variable, the value of
1270 <tt>i18n.commitencoding
</tt> is used instead.
</p></div>
1273 <div class=
"paragraph"><p>Note that we deliberately chose not to re-code the commit log
1274 message when a commit is made to force UTF-
8 at the commit
1275 object level, because re-coding to UTF-
8 is not necessarily a
1276 reversible operation.
</p></div>
1278 <h2 id=
"_environment_and_configuration_variables">ENVIRONMENT AND CONFIGURATION VARIABLES
</h2>
1279 <div class=
"sectionbody">
1280 <div class=
"paragraph"><p>The editor used to edit the commit log message will be chosen from the
1281 GIT_EDITOR environment variable, the core.editor configuration variable, the
1282 VISUAL environment variable, or the EDITOR environment variable (in that
1283 order). See
<a href=
"git-var.html">git-var(
1)
</a> for details.
</p></div>
1285 <h2 id=
"_hooks">HOOKS
</h2>
1286 <div class=
"sectionbody">
1287 <div class=
"paragraph"><p>This command can run
<tt>commit-msg
</tt>,
<tt>prepare-commit-msg
</tt>,
<tt>pre-commit
</tt>,
1288 and
<tt>post-commit
</tt> hooks. See
<a href=
"githooks.html">githooks(
5)
</a> for more
1289 information.
</p></div>
1291 <h2 id=
"_see_also">SEE ALSO
</h2>
1292 <div class=
"sectionbody">
1293 <div class=
"paragraph"><p><a href=
"git-add.html">git-add(
1)
</a>,
1294 <a href=
"git-rm.html">git-rm(
1)
</a>,
1295 <a href=
"git-mv.html">git-mv(
1)
</a>,
1296 <a href=
"git-merge.html">git-merge(
1)
</a>,
1297 <a href=
"git-commit-tree.html">git-commit-tree(
1)
</a></p></div>
1299 <h2 id=
"_git">GIT
</h2>
1300 <div class=
"sectionbody">
1301 <div class=
"paragraph"><p>Part of the
<a href=
"git.html">git(
1)
</a> suite
</p></div>
1304 <div id=
"footnotes"><hr /></div>
1306 <div id=
"footer-text">
1307 Last updated
2011-
09-
21 23:
01:
14 PDT