Code

Teach --stdin option to "log" family
[git.git] / Documentation / git-commit.txt
index 861ce93a49fcfd6498344c107c32c39f26cf8b00..0578a40d841348b5ae484e1fe15ce637ecc4b830 100644 (file)
@@ -8,28 +8,29 @@ git-commit - Record changes to the repository
 SYNOPSIS
 --------
 [verse]
-'git-commit' [-a | --interactive] [-s] [-v] [-u] [--amend]
+'git commit' [-a | --interactive] [-s] [-v] [-u<mode>] [--amend] [--dry-run]
           [(-c | -C) <commit>] [-F <file> | -m <msg>]
           [--allow-empty] [--no-verify] [-e] [--author=<author>]
           [--cleanup=<mode>] [--] [[-i | -o ]<file>...]
 
 DESCRIPTION
 -----------
-Use 'git commit' to store the current contents of the index in a new
-commit along with a log message describing the changes you have made.
+Stores the current contents of the index in a new commit along
+with a log message from the user describing the changes.
 
 The content to be added can be specified in several ways:
 
-1. by using linkgit:git-add[1] to incrementally "add" changes to the
+1. by using 'git-add' to incrementally "add" changes to the
    index before using the 'commit' command (Note: even modified
    files must be "added");
 
-2. by using linkgit:git-rm[1] to remove files from the working tree
+2. by using 'git-rm' to remove files from the working tree
    and the index, again before using the 'commit' command;
 
 3. by listing files as arguments to the 'commit' command, in which
    case the commit will ignore changes staged in the index, and instead
-   record the current content of the listed files;
+   record the current content of the listed files (which must already
+   be known to git);
 
 4. by using the -a switch with the 'commit' command to automatically
    "add" changes from all known files (i.e. all files that are already
@@ -39,15 +40,14 @@ The content to be added can be specified in several ways:
 
 5. by using the --interactive switch with the 'commit' command to decide one
    by one which files should be part of the commit, before finalizing the
-   operation.  Currently, this is done by invoking `git-add --interactive`.
+   operation.  Currently, this is done by invoking 'git-add --interactive'.
 
-The linkgit:git-status[1] command can be used to obtain a
+The `--dry-run` option can be used to obtain a
 summary of what is included by any of the above for the next
-commit by giving the same set of parameters you would give to
-this command.
+commit by giving the same set of parameters (options and paths).
 
-If you make a commit and then found a mistake immediately after
-that, you can recover from it with linkgit:git-reset[1].
+If you make a commit and then find a mistake immediately after
+that, you can recover from it with 'git-reset'.
 
 
 OPTIONS
@@ -75,8 +75,10 @@ OPTIONS
        read the message from the standard input.
 
 --author=<author>::
-       Override the author name used in the commit.  Use
-       `A U Thor <author@example.com>` format.
+       Override the author name used in the commit.  You can use the
+       standard `A U Thor <author@example.com>` format.  Otherwise,
+       an existing commit that matches the given string and its author
+       name is used.
 
 -m <msg>::
 --message=<msg>::
@@ -92,12 +94,13 @@ OPTIONS
 
 -s::
 --signoff::
-       Add Signed-off-by line at the end of the commit message.
+       Add Signed-off-by line by the committer at the end of the commit
+       log message.
 
 -n::
 --no-verify::
        This option bypasses the pre-commit and commit-msg hooks.
-       See also linkgit:githooks[5][hooks].
+       See also linkgit:githooks[5].
 
 --allow-empty::
        Usually recording a commit that has the exact same tree as its
@@ -142,6 +145,10 @@ It is a rough equivalent for:
 ------
 but can be used to amend a merge commit.
 --
++
+You should understand the implications of rewriting history if you
+amend a commit that has already been published.  (See the "RECOVERING
+FROM UPSTREAM REBASE" section in linkgit:git-rebase[1].)
 
 -i::
 --include::
@@ -155,20 +162,29 @@ but can be used to amend a merge commit.
        Make a commit only from the paths specified on the
        command line, disregarding any contents that have been
        staged so far. This is the default mode of operation of
-       'git commit' if any paths are given on the command line,
+       'git-commit' if any paths are given on the command line,
        in which case this option can be omitted.
        If this option is specified together with '--amend', then
-       no paths need be specified, which can be used to amend
+       no paths need to be specified, which can be used to amend
        the last commit without committing changes that have
        already been staged.
 
--u::
---untracked-files::
-       Show all untracked files, also those in uninteresting
-       directories, in the "Untracked files:" section of commit
-       message template.  Without this option only its name and
-       a trailing slash are displayed for each untracked
-       directory.
+-u[<mode>]::
+--untracked-files[=<mode>]::
+       Show untracked files (Default: 'all').
++
+The mode parameter is optional, and is used to specify
+the handling of untracked files. The possible options are:
++
+--
+       - 'no'     - Show no untracked files
+       - 'normal' - Shows untracked files and directories
+       - 'all'    - Also shows individual files in untracked directories.
+--
++
+See linkgit:git-config[1] for configuration variable
+used to change the default for when the option is not
+specified.
 
 -v::
 --verbose::
@@ -181,6 +197,11 @@ but can be used to amend a merge commit.
 --quiet::
        Suppress commit summary message.
 
+--dry-run::
+       Do not create a commit, but show a list of paths that are
+       to be committed, paths with local changes that will be left
+       uncommitted and paths that are untracked.
+
 \--::
        Do not interpret any more arguments as options.
 
@@ -196,10 +217,10 @@ EXAMPLES
 --------
 When recording your own work, the contents of modified files in
 your working tree are temporarily stored to a staging area
-called the "index" with linkgit:git-add[1].  A file can be
+called the "index" with 'git-add'.  A file can be
 reverted back, only in the index but not in the working tree,
-to that of the last commit with `git-reset HEAD -- <file>`,
-which effectively reverts `git-add` and prevents the changes to
+to that of the last commit with `git reset HEAD -- <file>`,
+which effectively reverts 'git-add' and prevents the changes to
 this file from participating in the next commit.  After building
 the state to be committed incrementally with these commands,
 `git commit` (without any pathname parameter) is used to record what
@@ -255,13 +276,13 @@ $ git commit
 this second commit would record the changes to `hello.c` and
 `hello.h` as expected.
 
-After a merge (initiated by either linkgit:git-merge[1] or
-linkgit:git-pull[1]) stops because of conflicts, cleanly merged
+After a merge (initiated by 'git-merge' or 'git-pull') stops
+because of conflicts, cleanly merged
 paths are already staged to be committed for you, and paths that
 conflicted are left in unmerged state.  You would have to first
-check which paths are conflicting with linkgit:git-status[1]
+check which paths are conflicting with 'git-status'
 and after fixing them manually in your working tree, you would
-stage the result as usual with linkgit:git-add[1]:
+stage the result as usual with 'git-add':
 
 ------------
 $ git status | grep unmerged
@@ -307,7 +328,7 @@ order).
 HOOKS
 -----
 This command can run `commit-msg`, `prepare-commit-msg`, `pre-commit`,
-and `post-commit` hooks.  See linkgit:githooks[5][hooks] for more
+and `post-commit` hooks.  See linkgit:githooks[5] for more
 information.