]> git.ipfire.org Git - thirdparty/git.git/blobdiff - Documentation/git-commit.txt
Merge branch 'en/ort-perf-batch-9'
[thirdparty/git.git] / Documentation / git-commit.txt
index 76281932847ba95197894a6b972ef3cb157a40ba..340c5fbb48fc1ba82fa693048e600186e8556b21 100644 (file)
@@ -9,11 +9,13 @@ SYNOPSIS
 --------
 [verse]
 'git commit' [-a | --interactive | --patch] [-s] [-v] [-u<mode>] [--amend]
-          [--dry-run] [(-c | -C | --fixup | --squash) <commit>]
+          [--dry-run] [(-c | -C | --squash) <commit> | --fixup [(amend|reword):]<commit>)]
           [-F <file> | -m <msg>] [--reset-author] [--allow-empty]
           [--allow-empty-message] [--no-verify] [-e] [--author=<author>]
           [--date=<date>] [--cleanup=<mode>] [--[no-]status]
-          [-i | -o] [-S[<keyid>]] [--] [<file>...]
+          [-i | -o] [--pathspec-from-file=<file> [--pathspec-file-nul]]
+          [(--trailer <token>[(=|:)<value>])...] [-S[<keyid>]]
+          [--] [<pathspec>...]
 
 DESCRIPTION
 -----------
@@ -58,6 +60,7 @@ commit by giving the same set of parameters (options and paths).
 If you make a commit and then find a mistake immediately after
 that, you can recover from it with 'git reset'.
 
+:git-commit: 1
 
 OPTIONS
 -------
@@ -84,11 +87,44 @@ OPTIONS
        Like '-C', but with `-c` the editor is invoked, so that
        the user can further edit the commit message.
 
---fixup=<commit>::
-       Construct a commit message for use with `rebase --autosquash`.
-       The commit message will be the subject line from the specified
-       commit with a prefix of "fixup! ".  See linkgit:git-rebase[1]
-       for details.
+--fixup=[(amend|reword):]<commit>::
+       Create a new commit which "fixes up" `<commit>` when applied with
+       `git rebase --autosquash`. Plain `--fixup=<commit>` creates a
+       "fixup!" commit which changes the content of `<commit>` but leaves
+       its log message untouched. `--fixup=amend:<commit>` is similar but
+       creates an "amend!" commit which also replaces the log message of
+       `<commit>` with the log message of the "amend!" commit.
+       `--fixup=reword:<commit>` creates an "amend!" commit which
+       replaces the log message of `<commit>` with its own log message
+       but makes no changes to the content of `<commit>`.
++
+The commit created by plain `--fixup=<commit>` has a subject
+composed of "fixup!" followed by the subject line from <commit>,
+and is recognized specially by `git rebase --autosquash`. The `-m`
+option may be used to supplement the log message of the created
+commit, but the additional commentary will be thrown away once the
+"fixup!" commit is squashed into `<commit>` by
+`git rebase --autosquash`.
++
+The commit created by `--fixup=amend:<commit>` is similar but its
+subject is instead prefixed with "amend!". The log message of
+<commit> is copied into the log message of the "amend!" commit and
+opened in an editor so it can be refined. When `git rebase
+--autosquash` squashes the "amend!" commit into `<commit>`, the
+log message of `<commit>` is replaced by the refined log message
+from the "amend!" commit. It is an error for the "amend!" commit's
+log message to be empty unless `--allow-empty-message` is
+specified.
++
+`--fixup=reword:<commit>` is shorthand for `--fixup=amend:<commit>
+--only`. It creates an "amend!" commit with only a log message
+(ignoring any changes staged in the index). When squashed by `git
+rebase --autosquash`, it replaces the log message of `<commit>`
+without making any other changes.
++
+Neither "fixup!" nor "amend!" commits change authorship of
+`<commit>` when applied by `git rebase --autosquash`.
+See linkgit:git-rebase[1] for details.
 
 --squash=<commit>::
        Construct a commit message for use with `rebase --autosquash`.
@@ -162,14 +198,18 @@ The `-m` option is mutually exclusive with `-c`, `-C`, and `-F`.
        message, the commit is aborted.  This has no effect when a message
        is given by other means, e.g. with the `-m` or `-F` options.
 
--s::
---signoff::
-       Add Signed-off-by line by the committer at the end of the commit
-       log message.  The meaning of a signoff depends on the project,
-       but it typically certifies that committer has
-       the rights to submit this work under the same license and
-       agrees to a Developer Certificate of Origin
-       (see http://developercertificate.org/ for more information).
+include::signoff-option.txt[]
+
+--trailer <token>[(=|:)<value>]::
+       Specify a (<token>, <value>) pair that should be applied as a
+       trailer. (e.g. `git commit --trailer "Signed-off-by:C O Mitter \
+       <committer@example.com>" --trailer "Helped-by:C O Mitter \
+       <committer@example.com>"` will add the "Signed-off-by" trailer
+       and the "Helped-by" trailer to the commit message.)
+       The `trailer.*` configuration variables
+       (linkgit:git-interpret-trailers[1]) can be used to define if
+       a duplicated trailer is omitted, where in the run of trailers
+       each trailer would appear, and other details.
 
 -n::
 --no-verify::
@@ -278,22 +318,37 @@ FROM UPSTREAM REBASE" section in linkgit:git-rebase[1].)
        already been staged. If used together with `--allow-empty`
        paths are also not required, and an empty commit will be created.
 
+--pathspec-from-file=<file>::
+       Pathspec is passed in `<file>` instead of commandline args. If
+       `<file>` is exactly `-` then standard input is used. Pathspec
+       elements are separated by LF or CR/LF. Pathspec elements can be
+       quoted as explained for the configuration variable `core.quotePath`
+       (see linkgit:git-config[1]). See also `--pathspec-file-nul` and
+       global `--literal-pathspecs`.
+
+--pathspec-file-nul::
+       Only meaningful with `--pathspec-from-file`. Pathspec elements are
+       separated with NUL character and all other characters are taken
+       literally (including newlines and quotes).
+
 -u[<mode>]::
 --untracked-files[=<mode>]::
        Show untracked files.
 +
+--
 The mode parameter is optional (defaults to 'all'), and is used to
 specify the handling of untracked files; when -u is not used, the
 default is 'normal', i.e. show untracked files and directories.
-+
+
 The possible options are:
-+
+
        - 'no'     - Show no untracked files
        - 'normal' - Shows untracked files and directories
        - 'all'    - Also shows individual files in untracked directories.
-+
+
 The default can be changed using the status.showUntrackedFiles
 configuration variable documented in linkgit:git-config[1].
+--
 
 -v::
 --verbose::
@@ -332,26 +387,23 @@ changes to tracked files.
 
 -S[<keyid>]::
 --gpg-sign[=<keyid>]::
+--no-gpg-sign::
        GPG-sign commits. The `keyid` argument is optional and
        defaults to the committer identity; if specified, it must be
-       stuck to the option without a space.
-
---no-gpg-sign::
-       Countermand `commit.gpgSign` configuration variable that is
-       set to force each and every commit to be signed.
+       stuck to the option without a space. `--no-gpg-sign` is useful to
+       countermand both `commit.gpgSign` configuration variable, and
+       earlier `--gpg-sign`.
 
 \--::
        Do not interpret any more arguments as options.
 
-<file>...::
-       When files are given on the command line, the command
-       commits the contents of the named files, without
-       recording the changes already staged.  The contents of
-       these files are also staged for the next commit on top
-       of what have been staged before.
-
-:git-commit: 1
-include::date-formats.txt[]
+<pathspec>...::
+       When pathspec is given on the command line, commit the contents of
+       the files that match the pathspec without recording the changes
+       already added to the index. The contents of these files are also
+       staged for the next commit on top of what have been staged before.
++
+For more details, see the 'pathspec' entry in linkgit:gitglossary[7].
 
 EXAMPLES
 --------
@@ -446,6 +498,43 @@ alter the order the changes are committed, because the merge
 should be recorded as a single commit.  In fact, the command
 refuses to run when given pathnames (but see `-i` option).
 
+COMMIT INFORMATION
+------------------
+
+Author and committer information is taken from the following environment
+variables, if set:
+
+       GIT_AUTHOR_NAME
+       GIT_AUTHOR_EMAIL
+       GIT_AUTHOR_DATE
+       GIT_COMMITTER_NAME
+       GIT_COMMITTER_EMAIL
+       GIT_COMMITTER_DATE
+
+(nb "<", ">" and "\n"s are stripped)
+
+The author and committer names are by convention some form of a personal name
+(that is, the name by which other humans refer to you), although Git does not
+enforce or require any particular form. Arbitrary Unicode may be used, subject
+to the constraints listed above. This name has no effect on authentication; for
+that, see the `credential.username` variable in linkgit:git-config[1].
+
+In case (some of) these environment variables are not set, the information
+is taken from the configuration items `user.name` and `user.email`, or, if not
+present, the environment variable EMAIL, or, if that is not set,
+system user name and the hostname used for outgoing mail (taken
+from `/etc/mailname` and falling back to the fully qualified hostname when
+that file does not exist).
+
+The `author.name` and `committer.name` and their corresponding email options
+override `user.name` and `user.email` if set and are overridden themselves by
+the environment variables.
+
+The typical usage is to set just the `user.name` and `user.email` variables;
+the other options are provided for more complex use cases.
+
+:git-commit: 1
+include::date-formats.txt[]
 
 DISCUSSION
 ----------