Documentation for common user misconceptions
v4 cover Documentation for common user misconceptions
This is v4 of a series improving the documentation to cover common user misconceptions.
I did opt to keep the big commit information section because I think it provides value when documenting the ordering of the variables. Otherwise, it becomes confusing to advanced users which options control what and in what order.
Changes from v3:
* Restructure docs around git-commit(1).
* Improve wording about templating as suggested by Peff.
* Document ordering between user.*, author.*, and committer.*.
* Document the environment variables more thoroughly.
Changes from v2:
* Move author and committer information to git-commit(1) where people will look for it.
* Move guidance on user.name format to git-commit(1) as well and mention a shortened form of the advice in the user.name description.
* Use a parenthetical to describe a "personal name" without contrasting it with a username.
* Offer a potential solution for people who want to ignore tracked files by recommending a templating mechanism.
* Be slightly more verbose about why memory is wasted with http.postBuffer.
Changes from v1:
* Remove parenthetical which was confusing.
* Add two more patches.
brian m. carlson (5):
doc: move author and committer information to git-commit(1)
docs: expand on possible and recommended user config options
doc: provide guidance on user.name format
doc: dissuade users from trying to ignore tracked files
docs: mention when increasing http.postBuffer is valuable
Documentation/config/http.txt | 8 ++++++ Documentation/config/user.txt | 7 +++++- Documentation/git-commit-tree.txt | 26 ++++--------------- Documentation/git-commit.txt | 40 +++++++++++++++++++++++++++--- Documentation/git-update-index.txt | 16 ++++++++++++ Documentation/git.txt | 27 ++++++++++++++++++-- 6 files changed, 97 insertions(+), 27 deletions(-)
PATCH v4 1/5 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.
--- Documentation/config/user.txt | 2 +- Documentation/git-commit-tree.txt | 26 +++++--------------------- Documentation/git-commit.txt | 27 ++++++++++++++++++++++++--- Documentation/git.txt | 27 +++++++++++++++++++++++++-- 4 files changed, 55 insertions(+), 27 deletions(-)
Documentation/config/user.txt +1 -1
@@ -13,7 +13,7 @@ committer.email:: Also, all of these can be overridden by the `GIT_AUTHOR_NAME`, `GIT_AUTHOR_EMAIL`, `GIT_COMMITTER_NAME`, `GIT_COMMITTER_EMAIL` and `EMAIL` environment variables. - See linkgit:git-commit-tree[1] for more information. + See linkgit:git-commit[1] for more information. user.useConfigOnly:: Instruct Git to avoid trying to guess defaults for `user.email`
Documentation/git-commit-tree.txt +5 -21
@@ -42,6 +42,10 @@ tend to just write the result to the file that is pointed at by `.git/HEAD`, so that we can always see what the last committed state was. +A commit comment is read from stdin. If a changelog +entry is not provided via "<" redirection, 'git commit-tree' will just wait +for one to be entered and terminated with ^D. + OPTIONS ------- <tree>::
@@ -69,7 +73,6 @@ OPTIONS Do not GPG-sign commit, to countermand a `--gpg-sign` option given earlier on the command line. - Commit Information ------------------
@@ -79,26 +82,6 @@ A commit encapsulates: - author name, email and date - committer name and email and the commit time. -While parent object ids are provided on the command line, 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) - -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). - A commit comment is read from stdin. If a changelog entry is not provided via "<" redirection, 'git commit-tree' will just wait for one to be entered and terminated with ^D.
@@ -117,6 +100,7 @@ FILES SEE ALSO -------- linkgit:git-write-tree[1] +linkgit:git-commit[1] GIT ---
Documentation/git-commit.txt +24 -3
@@ -367,9 +367,6 @@ changes to tracked files. + For more details, see the 'pathspec' entry in linkgit:gitglossary[7]. -:git-commit: 1 -include::date-formats.txt[] - EXAMPLES -------- 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 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) + +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). + +:git-commit: 1 +include::date-formats.txt[] DISCUSSION ----------
Documentation/git.txt +25 -2
@@ -482,13 +482,36 @@ double-quotes and respecting backslash escapes. E.g., the value Git Commits ~~~~~~~~~~~ `GIT_AUTHOR_NAME`:: + The human-readable name used in the author identity when creating commit or + tag objects, or when writing reflogs. Overrides the `user.name` and + `author.name` configuration settings. + `GIT_AUTHOR_EMAIL`:: + The email address used in the author identity when creating commit or + tag objects, or when writing reflogs. Overrides the `user.email` and + `author.email` configuration settings. + `GIT_AUTHOR_DATE`:: + The date used for the author identity when creating commit or tag objects, or + when writing reflogs. See linkgit:git-commit[1] for valid formats. + `GIT_COMMITTER_NAME`:: + The human-readable name used in the committer identity when creating commit or + tag objects, or when writing reflogs. Overrides the `user.name` and + `committer.name` configuration settings. + `GIT_COMMITTER_EMAIL`:: + The email address used in the author identity when creating commit or + tag objects, or when writing reflogs. Overrides the `user.email` and + `committer.email` configuration settings. + `GIT_COMMITTER_DATE`:: -'EMAIL':: - see linkgit:git-commit-tree[1] + The date used for the committer identity when creating commit or tag objects, or + when writing reflogs. See linkgit:git-commit[1] for valid formats. + +`EMAIL`:: + The email address used in the author and committer identities if no other + relevant environment variable or configuration setting has been set. Git Diffs ~~~~~~~~~
Re: [PATCH v4 1/5] doc: move author and committer information to git-commit(1)
Quoted 5 lines · brian m. carlson
Documentation/git-commit-tree.txt +0
-0
Documentation/git-commit-tree.txt tend to just write the result to the file that is pointed at by · line 51
Quoted 10 lines
Documentation/git-commit-tree.txt +4
-0@@ -42,6 +42,10 @@ tend to just write the result to the file that is pointed at by `.git/HEAD`, so that we can always see what the last committed state was. +A commit comment is read from stdin. If a changelog +entry is not provided via "<" redirection, 'git commit-tree' will just wait +for one to be entered and terminated with ^D. + OPTIONS ------- <tree>::
This text got moved up, which kind of make sense to me, but...
Quoted 17 lines
Documentation/git-commit-tree.txt +0
-13@@ -79,26 +82,6 @@ A commit encapsulates: - author name, email and date - committer name and email and the commit time. -While parent object ids are provided on the command line, 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) -
Documentation/git-commit-tree.txt A commit encapsulates: · line 87
Quoted 10 lines
Documentation/git-commit-tree.txt +0
-7-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). - A commit comment is read from stdin. If a changelog entry is not provided via "<" redirection, 'git commit-tree' will just wait for one to be entered and terminated with ^D.
it stayed here, so now it's duplicated. Should the old one be dropped? Or is moving the new text a leftover mistake from rebasing (IIRC, in your original you dropped this whole "here's how commits work" section).
Other than that, the patch looks good to me.
-Peff
Re: [PATCH v4 1/5] doc: move author and committer information to git-commit(1)
Quoted 20 lines · Jeff King
Quoted 5 lines · brian m. carlson
Documentation/git-commit-tree.txt +0
-0Documentation/git-commit-tree.txt tend to just write the result to the file that is pointed at by · line 51
Quoted 10 lines
Documentation/git-commit-tree.txt +4
-0@@ -42,6 +42,10 @@ tend to just write the result to the file that is pointed at by `.git/HEAD`, so that we can always see what the last committed state was. +A commit comment is read from stdin. If a changelog +entry is not provided via "<" redirection, 'git commit-tree' will just wait +for one to be entered and terminated with ^D. + OPTIONS ------- <tree>::This text got moved up, which kind of make sense to me, but...
Quoted 5 lines
it stayed here, so now it's duplicated. Should the old one be dropped? Or is moving the new text a leftover mistake from rebasing (IIRC, in your original you dropped this whole "here's how commits work" section).
Other than that, the patch looks good to me.
Thanks for pointing this out. I'll fix it and if nobody else has comments today, send out a v5 later this week, probably tomorrow.
Signature · 2 lines
brian m. carlson: Houston, Texas, US OpenPGP: https://keybase.io/bk2204
Re: [PATCH v4 1/5] doc: move author and committer information to git-commit(1)
In reply to Jeff KingQuoted 7 lines · Jeff King
Quoted 3 lines
A commit comment is read from stdin. If a changelog
entry is not provided via "<" redirection, 'git commit-tree' will just wait for one to be entered and terminated with ^D.it stayed here, so now it's duplicated. Should the old one be dropped? Or is moving the new text a leftover mistake from rebasing (IIRC, in your original you dropped this whole "here's how commits work" section).
Ah, you spotted the same thing.
Re: [PATCH v4 1/5] doc: move author and committer information to git-commit(1)
In reply to brian m. carlsonDocumentation/config/user.txt committer.email:: · line 16
Quoted 10 lines · brian m. carlson
Documentation/config/user.txt +1
-1@@ -13,7 +13,7 @@ committer.email:: Also, all of these can be overridden by the `GIT_AUTHOR_NAME`, `GIT_AUTHOR_EMAIL`, `GIT_COMMITTER_NAME`, `GIT_COMMITTER_EMAIL` and `EMAIL` environment variables. - See linkgit:git-commit-tree[1] for more information. + See linkgit:git-commit[1] for more information.
Makes sense---it is consistent with the goal of making the documentation of "git commit" Porcelain the central place for authorship and committer information.
Documentation/git-commit-tree.txt tend to just write the result to the file that is pointed at by · line 47
Quoted 11 lines
Documentation/git-commit-tree.txt +3
-0@@ -42,6 +42,10 @@ tend to just write the result to the file that is pointed at by `.git/HEAD`, so that we can always see what the last committed state was. +A commit comment is read from stdin. If a changelog +entry is not provided via "<" redirection, 'git commit-tree' will just wait +for one to be entered and terminated with ^D.
This is copied from the end of the "commit information" section, without the original getting removed (see the post-context of the hunk that begins at l.79/l.82). Intended?
I haven't seen anybody use the phrase "commit comment" in the reviews on this list for long time; the phrase somehow feels outdated. The pretty formats section in "git log --help" calls this "commit message". "log message" may also be more common.
Quoted 20 lines
Documentation/git-commit-tree.txt +0
-5@@ -69,7 +73,6 @@ OPTIONS Do not GPG-sign commit, to countermand a `--gpg-sign` option given earlier on the command line. - Commit Information ------------------@@ -79,26 +82,6 @@ A commit encapsulates: - author name, email and date - committer name and email and the commit time. -While parent object ids are provided on the command line, author and -... -that file does not exist). - A commit comment is read from stdin. If a changelog entry is not provided via "<" redirection, 'git commit-tree' will just wait for one to be entered and terminated with ^D.@@ -117,6 +100,7 @@ FILES
PATCH v4 2/5 docs: expand on possible and recommended user config options
In reply to brian m. carlsonIn the section on setting author and committer information, we omit the author.* and committer.* variables, so mention them for completeness. In addition, guide users to the typical case: simply setting user.name and user.email, which are recommended if one does not need complex configuration.
--- Documentation/git-commit.txt | 7 +++++++ 1 file changed, 7 insertions(+)
Documentation/git-commit.txt +7 -0
@@ -482,6 +482,13 @@ 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[]
PATCH v4 3/5 doc: provide guidance on user.name format
In reply to brian m. carlsonIt's a frequent misconception that the user.name variable controls authentication in some way, and as a result, beginning users frequently attempt to change it when they're having authentication troubles. Document that the convention is that this variable represents some form of a human's personal name, although that is not required. In addition, address concerns about whether Unicode is supported.
Use the term "personal name" as this is likely to draw the intended contrast, be applicable across cultures which may have different naming conventions, and be easily understandable to people who do not speak English as their first language. Indicate that "some form" is conventionally used, as people may use a nickname or preferred name instead of a full legal name.
Point users who may be confused about authentication to an appropriate configuration option instead. Provide a shortened form of this information in the configuration option description.
--- Documentation/config/user.txt | 7 ++++++- Documentation/git-commit.txt | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-)
Documentation/config/user.txt +6 -1
@@ -13,7 +13,12 @@ committer.email:: Also, all of these can be overridden by the `GIT_AUTHOR_NAME`, `GIT_AUTHOR_EMAIL`, `GIT_COMMITTER_NAME`, `GIT_COMMITTER_EMAIL` and `EMAIL` environment variables. - See linkgit:git-commit[1] for more information. ++ +Note that the `name` forms of these variables conventionally refer to +some form of a personal name. +See linkgit:git-commit[1] for more information on these settings and +the `credential.username` option if you're looking for authentication +credentials instead. user.useConfigOnly:: Instruct Git to avoid trying to guess defaults for `user.email`
Documentation/git-commit.txt +6 -0
@@ -475,6 +475,12 @@ variables, if set: (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,
Re: [PATCH v4 3/5] doc: provide guidance on user.name format
Documentation/config/user.txt committer.email:: · line 19
Quoted 13 lines · brian m. carlson
Documentation/config/user.txt +4
-1@@ -13,7 +13,12 @@ committer.email:: Also, all of these can be overridden by the `GIT_AUTHOR_NAME`, `GIT_AUTHOR_EMAIL`, `GIT_COMMITTER_NAME`, `GIT_COMMITTER_EMAIL` and `EMAIL` environment variables. - See linkgit:git-commit[1] for more information. ++ +Note that the `name` forms of these variables conventionally refer to +some form of a personal name. +See linkgit:git-commit[1] for more information on these settings and
The environment variables section of git(1) seems to be much more detailed than what we have in git-commit(1) after the two previous steps. I do not mind keeping the reference to git-commit here, but I think it is also OK to refer to the description in git(1) there, too.
Quoted 5 lines
Documentation/git-commit.txt +0
-0
Documentation/git-commit.txt variables, if set: · line 483
Quoted 9 lines
Documentation/git-commit.txt +6
-0@@ -475,6 +475,12 @@ variables, if set: (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]. +
Good.
PATCH v4 4/5 doc: dissuade users from trying to ignore tracked files
In reply to brian m. carlsonIt is quite common for users to want to ignore the changes to a file that Git tracks. Common scenarios for this case are IDE settings and configuration files, which should generally not be tracked and possibly generated from tracked files using a templating mechanism.
However, users learn about the assume-unchanged and skip-worktree bits and try to use them to do this anyway. This is problematic, because when these bits are set, many operations behave as the user expects, but they usually do not help when git checkout needs to replace a file.
There is no sensible behavior in this case, because sometimes the data is precious, such as certain configuration files, and sometimes it is irrelevant data that the user would be happy to discard.
Since this is not a supported configuration and users are prone to misuse the existing features for unintended purposes, causing general sadness and confusion, let's document the existing behavior and the pitfalls in the documentation for git update-index so that users know they should explore alternate solutions.
In addition, let's provide a recommended solution to dealing with the common case of configuration files, since there are well-known approaches used successfully in many environments.
---
Peff, since I've adopted a significant portion of what you've said here, it's probably worth getting your sign-off on this patch.
Documentation/git-update-index.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
Documentation/git-update-index.txt +16 -0
@@ -549,6 +549,22 @@ The untracked cache extension can be enabled by the `core.untrackedCache` configuration variable (see linkgit:git-config[1]). +NOTES +----- + +Users often try to use the assume-unchanged and skip-worktree bits +to tell Git to ignore changes to files that are tracked. This does not +work as expected, since Git may still check working tree files against +the index when performing certain operations. In general, Git does not +provide a way to ignore changes to tracked files, so alternate solutions +are recommended. + +For example, if the file you want to change is some sort of config file, +the repository can include a sample config file that can then be copied +into the ignored name and modified. The repository can even include a +script to treat the sample file as a template, modifying and copying it +automatically. + SEE ALSO -------- linkgit:git-config[1],
Re: [PATCH v4 4/5] doc: dissuade users from trying to ignore tracked files
Quoted 2 lines · brian m. carlson
Peff, since I've adopted a significant portion of what you've said here, it's probably worth getting your sign-off on this patch.
Sure thing:
And the patch itself looks good to me.
-Peff
PATCH v4 5/5 docs: mention when increasing http.postBuffer is valuable
In reply to brian m. carlsonUsers in a wide variety of situations find themselves with HTTP push problems. Oftentimes these issues are due to antivirus software, filtering proxies, or other man-in-the-middle situations; other times, they are due to simple unreliability of the network.
However, a common solution to HTTP push problems found online is to increase http.postBuffer. This works for none of the aforementioned situations and is only useful in a small, highly restricted number of
cases: essentially, when the connection does not properly support HTTP/1.1.
Document when raising this value is appropriate and what it actually does, and discourage people from using it as a general solution for push problems, since it is not effective there.
--- Documentation/config/http.txt | 8 ++++++++ 1 file changed, 8 insertions(+)
Documentation/config/http.txt +8 -0
@@ -199,6 +199,14 @@ http.postBuffer:: Transfer-Encoding: chunked is used to avoid creating a massive pack file locally. Default is 1 MiB, which is sufficient for most requests. ++ +Note that raising this limit is only effective for disabling chunked +transfer encoding and therefore should be used only where the remote +server or a proxy only supports HTTP/1.0 or is noncompliant with the +HTTP standard. Raising this is not, in general, an effective solution +for most push problems, but can increase memory consumption +significantly since the entire buffer is allocated even for small +pushes. http.lowSpeedLimit, http.lowSpeedTime:: If the HTTP transfer speed is less than 'http.lowSpeedLimit'
Quoted 2 lines · brian m. carlson
This is v4 of a series improving the documentation to cover common user misconceptions.
With the exception of the minor issue I pointed out in patch 1, these all look good to me.
-Peff