<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" | |
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<meta name="generator" content="AsciiDoc 7.0.2" /> | |
<style type="text/css"> | |
/* Debug borders */ | |
p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 { | |
/* | |
border: 1px solid red; | |
*/ | |
} | |
body { | |
margin: 1em 5% 1em 5%; | |
} | |
a { color: blue; } | |
a:visited { color: fuchsia; } | |
em { | |
font-style: italic; | |
} | |
strong { | |
font-weight: bold; | |
} | |
tt { | |
color: navy; | |
} | |
h1, h2, h3, h4, h5, h6 { | |
color: #527bbd; | |
font-family: sans-serif; | |
margin-top: 1.2em; | |
margin-bottom: 0.5em; | |
line-height: 1.3; | |
} | |
h1 { | |
border-bottom: 2px solid silver; | |
} | |
h2 { | |
border-bottom: 2px solid silver; | |
padding-top: 0.5em; | |
} | |
div.sectionbody { | |
font-family: serif; | |
margin-left: 0; | |
} | |
hr { | |
border: 1px solid silver; | |
} | |
p { | |
margin-top: 0.5em; | |
margin-bottom: 0.5em; | |
} | |
pre { | |
padding: 0; | |
margin: 0; | |
} | |
span#author { | |
color: #527bbd; | |
font-family: sans-serif; | |
font-weight: bold; | |
font-size: 1.2em; | |
} | |
span#email { | |
} | |
span#revision { | |
font-family: sans-serif; | |
} | |
div#footer { | |
font-family: sans-serif; | |
font-size: small; | |
border-top: 2px solid silver; | |
padding-top: 0.5em; | |
margin-top: 4.0em; | |
} | |
div#footer-text { | |
float: left; | |
padding-bottom: 0.5em; | |
} | |
div#footer-badges { | |
float: right; | |
padding-bottom: 0.5em; | |
} | |
div#preamble, | |
div.tableblock, div.imageblock, div.exampleblock, div.verseblock, | |
div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock, | |
div.admonitionblock { | |
margin-right: 10%; | |
margin-top: 1.5em; | |
margin-bottom: 1.5em; | |
} | |
div.admonitionblock { | |
margin-top: 2.5em; | |
margin-bottom: 2.5em; | |
} | |
div.content { /* Block element content. */ | |
padding: 0; | |
} | |
/* Block element titles. */ | |
div.title, caption.title { | |
font-family: sans-serif; | |
font-weight: bold; | |
text-align: left; | |
margin-top: 1.0em; | |
margin-bottom: 0.5em; | |
} | |
div.title + * { | |
margin-top: 0; | |
} | |
td div.title:first-child { | |
margin-top: 0.0em; | |
} | |
div.content div.title:first-child { | |
margin-top: 0.0em; | |
} | |
div.content + div.title { | |
margin-top: 0.0em; | |
} | |
div.sidebarblock > div.content { | |
background: #ffffee; | |
border: 1px solid silver; | |
padding: 0.5em; | |
} | |
div.listingblock > div.content { | |
border: 1px solid silver; | |
background: #f4f4f4; | |
padding: 0.5em; | |
} | |
div.quoteblock > div.content { | |
padding-left: 2.0em; | |
} | |
div.quoteblock .attribution { | |
text-align: right; | |
} | |
div.admonitionblock .icon { | |
vertical-align: top; | |
font-size: 1.1em; | |
font-weight: bold; | |
text-decoration: underline; | |
color: #527bbd; | |
padding-right: 0.5em; | |
} | |
div.admonitionblock td.content { | |
padding-left: 0.5em; | |
border-left: 2px solid silver; | |
} | |
div.exampleblock > div.content { | |
border-left: 2px solid silver; | |
padding: 0.5em; | |
} | |
div.verseblock div.content { | |
white-space: pre; | |
} | |
div.imageblock div.content { padding-left: 0; } | |
div.imageblock img { border: 1px solid silver; } | |
span.image img { border-style: none; } | |
dl { | |
margin-top: 0.8em; | |
margin-bottom: 0.8em; | |
} | |
dt { | |
margin-top: 0.5em; | |
margin-bottom: 0; | |
font-style: italic; | |
} | |
dd > *:first-child { | |
margin-top: 0; | |
} | |
ul, ol { | |
list-style-position: outside; | |
} | |
ol.olist2 { | |
list-style-type: lower-alpha; | |
} | |
div.tableblock > table { | |
border-color: #527bbd; | |
border-width: 3px; | |
} | |
thead { | |
font-family: sans-serif; | |
font-weight: bold; | |
} | |
tfoot { | |
font-weight: bold; | |
} | |
div.hlist { | |
margin-top: 0.8em; | |
margin-bottom: 0.8em; | |
} | |
td.hlist1 { | |
vertical-align: top; | |
font-style: italic; | |
padding-right: 0.8em; | |
} | |
td.hlist2 { | |
vertical-align: top; | |
} | |
@media print { | |
div#footer-badges { display: none; } | |
} | |
include::./stylesheets/xhtml11-manpage.css[] | |
/* Workarounds for IE6's broken and incomplete CSS2. */ | |
div.sidebar-content { | |
background: #ffffee; | |
border: 1px solid silver; | |
padding: 0.5em; | |
} | |
div.sidebar-title, div.image-title { | |
font-family: sans-serif; | |
font-weight: bold; | |
margin-top: 0.0em; | |
margin-bottom: 0.5em; | |
} | |
div.listingblock div.content { | |
border: 1px solid silver; | |
background: #f4f4f4; | |
padding: 0.5em; | |
} | |
div.quoteblock-content { | |
padding-left: 2.0em; | |
} | |
div.exampleblock-content { | |
border-left: 2px solid silver; | |
padding-left: 0.5em; | |
} | |
</style> | |
<title>git-commit(1)</title> | |
</head> | |
<body> | |
<div id="header"> | |
<h1> | |
git-commit(1) Manual Page | |
</h1> | |
<h2>NAME</h2> | |
<div class="sectionbody"> | |
<p>git-commit - | |
Record your changes | |
</p> | |
</div> | |
</div> | |
<h2>SYNOPSIS</h2> | |
<div class="sectionbody"> | |
<div class="verseblock"> | |
<div class="content"><em>git-commit</em> [-a] [-s] [-v] [(-c | -C) <commit> | -F <file> | -m <msg>] | |
[--no-verify] [--amend] [-e] [--author <author>] | |
[--] [[-i | -o ]<file>…]</div></div> | |
</div> | |
<h2>DESCRIPTION</h2> | |
<div class="sectionbody"> | |
<p>Updates the index file for given paths, or all modified files if | |
<em>-a</em> is specified, and makes a commit object. The command specified | |
by either the VISUAL or EDITOR environment variables are used to edit | |
the commit log message.</p> | |
<p>Several environment variable are used during commits. They are | |
documented in <a href="git-commit-tree.html">git-commit-tree(1)</a>.</p> | |
<p>This command can run <tt>commit-msg</tt>, <tt>pre-commit</tt>, and | |
<tt>post-commit</tt> hooks. See <a href="hooks.html">hooks</a> for more | |
information.</p> | |
</div> | |
<h2>OPTIONS</h2> | |
<div class="sectionbody"> | |
<dl> | |
<dt> | |
-a|--all | |
</dt> | |
<dd> | |
<p> | |
Update all paths in the index file. This flag notices | |
files that have been modified and deleted, but new files | |
you have not told git about are not affected. | |
</p> | |
</dd> | |
<dt> | |
-c or -C <commit> | |
</dt> | |
<dd> | |
<p> | |
Take existing commit object, and reuse the log message | |
and the authorship information (including the timestamp) | |
when creating the commit. With <em>-C</em>, the editor is not | |
invoked; with <em>-c</em> the user can further edit the commit | |
message. | |
</p> | |
</dd> | |
<dt> | |
-F <file> | |
</dt> | |
<dd> | |
<p> | |
Take the commit message from the given file. Use <em>-</em> to | |
read the message from the standard input. | |
</p> | |
</dd> | |
<dt> | |
--author <author> | |
</dt> | |
<dd> | |
<p> | |
Override the author name used in the commit. Use | |
<tt>A U Thor <author@example.com></tt> format. | |
</p> | |
</dd> | |
<dt> | |
-m <msg> | |
</dt> | |
<dd> | |
<p> | |
Use the given <msg> as the commit message. | |
</p> | |
</dd> | |
<dt> | |
-s|--signoff | |
</dt> | |
<dd> | |
<p> | |
Add Signed-off-by line at the end of the commit message. | |
</p> | |
</dd> | |
<dt> | |
-v|--verify | |
</dt> | |
<dd> | |
<p> | |
Look for suspicious lines the commit introduces, and | |
abort committing if there is one. The definition of | |
<em>suspicious lines</em> is currently the lines that has | |
trailing whitespaces, and the lines whose indentation | |
has a SP character immediately followed by a TAB | |
character. This is the default. | |
</p> | |
</dd> | |
<dt> | |
-n|--no-verify | |
</dt> | |
<dd> | |
<p> | |
The opposite of <tt>--verify</tt>. | |
</p> | |
</dd> | |
<dt> | |
-e|--edit | |
</dt> | |
<dd> | |
<p> | |
The message taken from file with <tt>-F</tt>, command line with | |
<tt>-m</tt>, and from file with <tt>-C</tt> are usually used as the | |
commit log message unmodified. This option lets you | |
further edit the message taken from these sources. | |
</p> | |
</dd> | |
<dt> | |
--amend | |
</dt> | |
<dd> | |
<p> | |
Used to amend the tip of the current branch. Prepare the tree | |
object you would want to replace the latest commit as usual | |
(this includes the usual -i/-o and explicit paths), and the | |
commit log editor is seeded with the commit message from the | |
tip of the current branch. The commit you create replaces the | |
current tip — if it was a merge, it will have the parents of | |
the current tip as parents — so the current top commit is | |
discarded. | |
</p> | |
<p>It is a rough equivalent for:</p> | |
<div class="listingblock"> | |
<div class="content"> | |
<pre><tt> $ git reset --soft HEAD^ | |
$ ... do something else to come up with the right tree ... | |
$ git commit -c ORIG_HEAD | |
</tt></pre> | |
</div></div> | |
<p>but can be used to amend a merge commit.</p> | |
</dd> | |
<dt> | |
-i|--include | |
</dt> | |
<dd> | |
<p> | |
Instead of committing only the files specified on the | |
command line, update them in the index file and then | |
commit the whole index. This is the traditional | |
behavior. | |
</p> | |
</dd> | |
<dt> | |
-o|--only | |
</dt> | |
<dd> | |
<p> | |
Commit only the files specified on the command line. | |
This format cannot be used during a merge, nor when the | |
index and the latest commit does not match on the | |
specified paths to avoid confusion. | |
</p> | |
</dd> | |
<dt> | |
-- | |
</dt> | |
<dd> | |
<p> | |
Do not interpret any more arguments as options. | |
</p> | |
</dd> | |
<dt> | |
<file>… | |
</dt> | |
<dd> | |
<p> | |
Files to be committed. The meaning of these is | |
different between <tt>--include</tt> and <tt>--only</tt>. Without | |
either, it defaults <tt>--only</tt> semantics. | |
</p> | |
</dd> | |
</dl> | |
<p>If you make a commit and then found a mistake immediately after | |
that, you can recover from it with <a href="git-reset.html">git-reset(1)</a>.</p> | |
</div> | |
<h2>Discussion</h2> | |
<div class="sectionbody"> | |
<p><tt>git commit</tt> without _any_ parameter commits the tree structure | |
recorded by the current index file. This is a whole-tree commit | |
even the command is invoked from a subdirectory.</p> | |
<p><tt>git commit --include paths…</tt> is equivalent to</p> | |
<div class="literalblock"> | |
<div class="content"> | |
<pre><tt>git update-index --remove paths... | |
git commit</tt></pre> | |
</div></div> | |
<p>That is, update the specified paths to the index and then commit | |
the whole tree.</p> | |
<p><tt>git commit paths…</tt> largely bypasses the index file and | |
commits only the changes made to the specified paths. It has | |
however several safety valves to prevent confusion.</p> | |
<ol> | |
<li> | |
<p> | |
It refuses to run during a merge (i.e. when | |
<tt>$GIT_DIR/MERGE_HEAD</tt> exists), and reminds trained git users | |
that the traditional semantics now needs -i flag. | |
</p> | |
</li> | |
<li> | |
<p> | |
It refuses to run if named <tt>paths…</tt> are different in HEAD | |
and the index (ditto about reminding). Added paths are OK. | |
This is because an earlier <tt>git diff</tt> (not <tt>git diff HEAD</tt>) | |
would have shown the differences since the last <tt>git | |
update-index paths…</tt> to the user, and an inexperienced user | |
may mistakenly think that the changes between the index and | |
the HEAD (i.e. earlier changes made before the last <tt>git | |
update-index paths…</tt> was done) are not being committed. | |
</p> | |
</li> | |
<li> | |
<p> | |
It reads HEAD commit into a temporary index file, updates the | |
specified <tt>paths…</tt> and makes a commit. At the same time, | |
the real index file is also updated with the same <tt>paths…</tt>. | |
</p> | |
</li> | |
</ol> | |
<p><tt>git commit --all</tt> updates the index file with _all_ changes to | |
the working tree, and makes a whole-tree commit, regardless of | |
which subdirectory the command is invoked in.</p> | |
</div> | |
<h2>Author</h2> | |
<div class="sectionbody"> | |
<p>Written by Linus Torvalds <torvalds@osdl.org> and | |
Junio C Hamano <junkio@cox.net></p> | |
</div> | |
<h2>GIT</h2> | |
<div class="sectionbody"> | |
<p>Part of the <a href="git.html">git(7)</a> suite</p> | |
</div> | |
<div id="footer"> | |
<div id="footer-text"> | |
Last updated 15-Jul-2006 01:37:38 UTC | |
</div> | |
</div> | |
</body> | |
</html> |