Skip to content

Commit bc94e58

Browse files
bk2204gitster
authored andcommitted
doc: move author and committer information to git-commit(1)
While at one time it made perfect sense to store information about configuring author and committer information in the documentation for git commit-tree, in modern Git that operation is seldom used. Most users will use git commit and expect to find comprehensive documentation about its use in the manual page for that command. Considering that there is significant confusion about how one is to use the user.name and user.email variables, let's put as much documentation as possible into an obvious place where users will be more likely to find it. In addition, expand the environment variables section to describe their use more fully. Even though we now describe all of the options there and in the configuration settings documentation, preserve the existing text in git-commit.txt so that people can easily reason about the ordering of the various options they can use. Explain the use of the author.* and committer.* options as well. Signed-off-by: brian m. carlson <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2323784 commit bc94e58

File tree

4 files changed

+51
-27
lines changed

4 files changed

+51
-27
lines changed

Documentation/config/user.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ committer.email::
1313
Also, all of these can be overridden by the `GIT_AUTHOR_NAME`,
1414
`GIT_AUTHOR_EMAIL`, `GIT_COMMITTER_NAME`,
1515
`GIT_COMMITTER_EMAIL` and `EMAIL` environment variables.
16-
See linkgit:git-commit-tree[1] for more information.
16+
See linkgit:git-commit[1] for more information.
1717

1818
user.useConfigOnly::
1919
Instruct Git to avoid trying to guess defaults for `user.email`

Documentation/git-commit-tree.txt

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ OPTIONS
6969
Do not GPG-sign commit, to countermand a `--gpg-sign` option
7070
given earlier on the command line.
7171

72-
7372
Commit Information
7473
------------------
7574

@@ -79,26 +78,6 @@ A commit encapsulates:
7978
- author name, email and date
8079
- committer name and email and the commit time.
8180

82-
While parent object ids are provided on the command line, author and
83-
committer information is taken from the following environment variables,
84-
if set:
85-
86-
GIT_AUTHOR_NAME
87-
GIT_AUTHOR_EMAIL
88-
GIT_AUTHOR_DATE
89-
GIT_COMMITTER_NAME
90-
GIT_COMMITTER_EMAIL
91-
GIT_COMMITTER_DATE
92-
93-
(nb "<", ">" and "\n"s are stripped)
94-
95-
In case (some of) these environment variables are not set, the information
96-
is taken from the configuration items user.name and user.email, or, if not
97-
present, the environment variable EMAIL, or, if that is not set,
98-
system user name and the hostname used for outgoing mail (taken
99-
from `/etc/mailname` and falling back to the fully qualified hostname when
100-
that file does not exist).
101-
10281
A commit comment is read from stdin. If a changelog
10382
entry is not provided via "<" redirection, 'git commit-tree' will just wait
10483
for one to be entered and terminated with ^D.
@@ -117,6 +96,7 @@ FILES
11796
SEE ALSO
11897
--------
11998
linkgit:git-write-tree[1]
99+
linkgit:git-commit[1]
120100

121101
GIT
122102
---

Documentation/git-commit.txt

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,6 @@ changes to tracked files.
367367
+
368368
For more details, see the 'pathspec' entry in linkgit:gitglossary[7].
369369

370-
:git-commit: 1
371-
include::date-formats.txt[]
372-
373370
EXAMPLES
374371
--------
375372
When recording your own work, the contents of modified files in
@@ -463,6 +460,30 @@ alter the order the changes are committed, because the merge
463460
should be recorded as a single commit. In fact, the command
464461
refuses to run when given pathnames (but see `-i` option).
465462

463+
COMMIT INFORMATION
464+
------------------
465+
466+
Author and committer information is taken from the following environment
467+
variables, if set:
468+
469+
GIT_AUTHOR_NAME
470+
GIT_AUTHOR_EMAIL
471+
GIT_AUTHOR_DATE
472+
GIT_COMMITTER_NAME
473+
GIT_COMMITTER_EMAIL
474+
GIT_COMMITTER_DATE
475+
476+
(nb "<", ">" and "\n"s are stripped)
477+
478+
In case (some of) these environment variables are not set, the information
479+
is taken from the configuration items `user.name` and `user.email`, or, if not
480+
present, the environment variable EMAIL, or, if that is not set,
481+
system user name and the hostname used for outgoing mail (taken
482+
from `/etc/mailname` and falling back to the fully qualified hostname when
483+
that file does not exist).
484+
485+
:git-commit: 1
486+
include::date-formats.txt[]
466487

467488
DISCUSSION
468489
----------

Documentation/git.txt

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,13 +482,36 @@ double-quotes and respecting backslash escapes. E.g., the value
482482
Git Commits
483483
~~~~~~~~~~~
484484
`GIT_AUTHOR_NAME`::
485+
The human-readable name used in the author identity when creating commit or
486+
tag objects, or when writing reflogs. Overrides the `user.name` and
487+
`author.name` configuration settings.
488+
485489
`GIT_AUTHOR_EMAIL`::
490+
The email address used in the author identity when creating commit or
491+
tag objects, or when writing reflogs. Overrides the `user.email` and
492+
`author.email` configuration settings.
493+
486494
`GIT_AUTHOR_DATE`::
495+
The date used for the author identity when creating commit or tag objects, or
496+
when writing reflogs. See linkgit:git-commit[1] for valid formats.
497+
487498
`GIT_COMMITTER_NAME`::
499+
The human-readable name used in the committer identity when creating commit or
500+
tag objects, or when writing reflogs. Overrides the `user.name` and
501+
`committer.name` configuration settings.
502+
488503
`GIT_COMMITTER_EMAIL`::
504+
The email address used in the author identity when creating commit or
505+
tag objects, or when writing reflogs. Overrides the `user.email` and
506+
`committer.email` configuration settings.
507+
489508
`GIT_COMMITTER_DATE`::
490-
'EMAIL'::
491-
see linkgit:git-commit-tree[1]
509+
The date used for the committer identity when creating commit or tag objects, or
510+
when writing reflogs. See linkgit:git-commit[1] for valid formats.
511+
512+
`EMAIL`::
513+
The email address used in the author and committer identities if no other
514+
relevant environment variable or configuration setting has been set.
492515

493516
Git Diffs
494517
~~~~~~~~~

0 commit comments

Comments
 (0)