<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">\r
<head>\r
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />\r
-<meta name="generator" content="AsciiDoc 7.0.1" />\r
+<meta name="generator" content="AsciiDoc 7.0.2" />\r
<style type="text/css">\r
/* Debug borders */\r
p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {\r
<div class="sectionbody">\r
<div class="verseblock">\r
<div class="content"><em>git-commit</em> [-a] [-s] [-v] [(-c | -C) <commit> | -F <file> | -m <msg>]\r
- [-e] [--] <file>…</div></div>\r
+ [--no-verify] [--amend] [-e] [--author <author>]\r
+ [--] [[-i | -o ]<file>…]</div></div>\r
</div>\r
<h2>DESCRIPTION</h2>\r
<div class="sectionbody">\r
<em>-a</em> is specified, and makes a commit object. The command\r
VISUAL and EDITOR environment variables to edit the commit log\r
message.</p>\r
+<p>Several environment variable are used during commits. They are\r
+documented in <a href="git-commit-tree.html">git-commit-tree(1)</a>.</p>\r
<p>This command can run <tt>commit-msg</tt>, <tt>pre-commit</tt>, and\r
<tt>post-commit</tt> hooks. See <a href="hooks.html">hooks</a> for more\r
information.</p>\r
<p>\r
Update all paths in the index file. This flag notices\r
files that have been modified and deleted, but new files\r
- you have not told about git are not affected.\r
+ you have not told git about are not affected.\r
</p>\r
</dd>\r
<dt>\r
</p>\r
</dd>\r
<dt>\r
+--author <author>\r
+</dt>\r
+<dd>\r
+<p>\r
+ Override the author name used in the commit. Use\r
+ <tt>A U Thor <author@example.com></tt> format.\r
+</p>\r
+</dd>\r
+<dt>\r
-m <msg>\r
</dt>\r
<dd>\r
</p>\r
</dd>\r
<dt>\r
+--amend\r
+</dt>\r
+<dd>\r
+<p>\r
+ Used to amend the tip of the current branch. Prepare the tree\r
+ object you would want to replace the latest commit as usual\r
+ (this includes the usual -i/-o and explicit paths), and the\r
+ commit log editor is seeded with the commit message from the\r
+ tip of the current branch. The commit you create replaces the\r
+ current tip — if it was a merge, it will have the parents of\r
+ the current tip as parents — so the current top commit is\r
+ discarded.\r
+</p>\r
+<p>It is a rough equivalent for:</p>\r
+<div class="listingblock">\r
+<div class="content">\r
+<pre><tt> $ git reset --soft HEAD^\r
+ $ ... do something else to come up with the right tree ...\r
+ $ git commit -c ORIG_HEAD\r
+</tt></pre>\r
+</div></div>\r
+<p>but can be used to amend a merge commit.</p>\r
+</dd>\r
+<dt>\r
+-i|--include\r
+</dt>\r
+<dd>\r
+<p>\r
+ Instead of committing only the files specified on the\r
+ command line, update them in the index file and then\r
+ commit the whole index. This is the traditional\r
+ behaviour.\r
+</p>\r
+</dd>\r
+<dt>\r
+-o|--only\r
+</dt>\r
+<dd>\r
+<p>\r
+ Commit only the files specified on the command line.\r
+ This format cannot be used during a merge, nor when the\r
+ index and the latest commit does not match on the\r
+ specified paths to avoid confusion.\r
+</p>\r
+</dd>\r
+<dt>\r
—\r
</dt>\r
<dd>\r
</dt>\r
<dd>\r
<p>\r
- Update specified paths in the index file before committing.\r
+ Files to be committed. The meaning of these is\r
+ different between <tt>--include</tt> and <tt>--only</tt>. Without\r
+ either, it defaults <tt>--only</tt> semantics.\r
</p>\r
</dd>\r
</dl>\r
<p>If you make a commit and then found a mistake immediately after\r
that, you can recover from it with <a href="git-reset.html">git-reset(1)</a>.</p>\r
</div>\r
+<h2>Discussion</h2>\r
+<div class="sectionbody">\r
+<p><tt>git commit</tt> without _any_ parameter commits the tree structure\r
+recorded by the current index file. This is a whole-tree commit\r
+even the command is invoked from a subdirectory.</p>\r
+<p><tt>git commit --include paths…</tt> is equivalent to</p>\r
+<div class="literalblock">\r
+<div class="content">\r
+<pre><tt>git update-index --remove paths...\r
+git commit</tt></pre>\r
+</div></div>\r
+<p>That is, update the specified paths to the index and then commit\r
+the whole tree.</p>\r
+<p><tt>git commit paths…</tt> largely bypasses the index file and\r
+commits only the changes made to the specified paths. It has\r
+however several safety valves to prevent confusion.</p>\r
+<ol>\r
+<li>\r
+<p>\r
+It refuses to run during a merge (i.e. when\r
+ <tt>$GIT_DIR/MERGE_HEAD</tt> exists), and reminds trained git users\r
+ that the traditional semantics now needs -i flag.\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+It refuses to run if named <tt>paths…</tt> are different in HEAD\r
+ and the index (ditto about reminding). Added paths are OK.\r
+ This is because an earlier <tt>git diff</tt> (not <tt>git diff HEAD</tt>)\r
+ would have shown the differences since the last <tt>git\r
+ update-index paths…</tt> to the user, and an inexperienced user\r
+ may mistakenly think that the changes between the index and\r
+ the HEAD (i.e. earlier changes made before the last <tt>git\r
+ update-index paths…</tt> was done) are not being committed.\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+It reads HEAD commit into a temporary index file, updates the\r
+ specified <tt>paths…</tt> and makes a commit. At the same time,\r
+ the real index file is also updated with the same <tt>paths…</tt>.\r
+</p>\r
+</li>\r
+</ol>\r
+<p><tt>git commit --all</tt> updates the index file with _all_ changes to\r
+the working tree, and makes a whole-tree commit, regardless of\r
+which subdirectory the command is invoked in.</p>\r
+</div>\r
<h2>Author</h2>\r
<div class="sectionbody">\r
<p>Written by Linus Torvalds <torvalds@osdl.org> and\r
</div>\r
<div id="footer">\r
<div id="footer-text">\r
-Last updated 13-Jan-2006 19:58:26 PDT\r
+Last updated 05-Apr-2006 23:07:59 UTC\r
</div>\r
</div>\r
</body>\r