Re: [PATCH] doc: Modify git-add doc to say "staging area"
On Thu, Dec 14, 2017 at 1:16 PM, David A. Wheelerwrote: > "David A. Wheeler" writes: >> > Why is "index" better? It is a confusing name, one that has many >> > other unrelated meanings. In particular, many projects managed by >> > git also have an index, but few have a staging area. > > On Thu, 14 Dec 2017 11:40:51 -0800, Junio C Hamano wrote: >> That's an absurd argument. A database product that wants to be used >> in library systems are forbidden to have "index" because that may be >> confused with library index cards? > > No, because most database systems aren't designed to be primarily used > in library systems. Even if they are, I haven't seen a "library index card" > in decades (many people will not know what they are), so > that is much less likely to be confusing. > > In contrast, git is widely used to manage source code (where "index" often > means "array index", "hash index", and so on) and/or HTML > (where "index.html" is pretty common). Using the *same* term for something > git often manages *is* confusing. > > Even if you don't buy that argument, I think most newer users find the term > "staging area" simpler... and we are *all* new to something at one time. > > A Google of git "staging area" returns 67,000 results, and "staging area" > is *much* newer terminology than "index" and has those hits in *spite* of > "index" and "cache" being the historical terms. > > Is there a term you'd prefer over "index" or "cache"? > I would personally prefer to drop 'cache', as the mechanism involved is not a cache from the users point of view. (A cache is not affecting behavior except for performance. In Git this "index" does affect more than just performance, it also allows a very specific workflow.) Personally I am indifferent to whether we call it index or staging area as long as it is consistent. Junio mentioned the 'X acts like Y' is different from 'X is Y'", so maybe we can use both words, as in "Use git-add to add files into the index, which is used as a staging area for the next commit". Note that this discussion seems to be quite old (way older than my contribution record): $ git log --grep "staging area" ... commit 11920d28da1ac1b65eb4041c1b7355924e5d1366 Author: Scott Chacon Date: 2008-12-01 22:14 Add a built-in alias for 'stage' to the 'add' command This comes from conversation at the GitTogether where we thought it would be helpful to be able to teach people to 'stage' files because it tends to cause confusion when told that they have to keep 'add'ing them. This continues the movement to start referring to the index as a staging area (eg: the --staged alias to 'git diff'). Also adds a doc file for 'git stage' that basically points to the docs for 'git add'. Signed-off-by: Scott Chacon Signed-off-by: Junio C Hamano
Re: [PATCH] doc: Modify git-add doc to say "staging area"
On Thu, Dec 14 2017, Junio C. Hamano jotted: > Stefan Bellerwrites: > >> Anyway I think spending list band width on good documentation is >> not bandwidth wasted. > > I agree with that. I do not consider the proposed change "good". The case you're talking about upthread is something which we could describe in the docs as "the starting point of the staging area is that it's equivalent to the current commit, and is thus used as an index/cache by various commands", if that ever comes up. I think in the vast majority of other cases talking about it as the staging area would be an improvement, since that's the function that has the closest correspondence to what the UI is actually doing, that we're using it as a cache / index is usually (always?) an implementation detail. Even the merge case you mentioned is something where staging area makes more sense: "We tried to merge, but had a conflict, we've staged some of your changes leaving the rest for you to sort out".
Re: [PATCH] doc: Modify git-add doc to say "staging area"
"David A. Wheeler"writes: > On December 14, 2017 1:50:00 PM EST, Junio C Hamano wrote: >>I agree with that. I do not consider the proposed change "good". > > Why is "index" better? It is a confusing name, one that has many > other unrelated meanings. In particular, many projects managed by > git also have an index, but few have a staging area. That's an absurd argument. A database product that wants to be used in library systems are forbidden to have "index" because that may be confused with library index cards? > Also, the phrase "staging area" is already in use, so this is not > a new term (e.g., git-staging). That gets us back to the "'X acts like Y' is different from 'X is Y'". Besides, the phrase "staging area" is a near-sighted and narrow minded term. It focuses too much on working towards the next commit, and ignores there are other aspects that are equally important. When you check out historical revisions (without any intention of making new commits, just sightseeing), for example, the index does not act as "staging area" for creating a new commit. But it still serves Git users by keeping track of the list of paths that came from the HEAD, and recording their contents and the cached stat info for the working tree files (all using the pathnames as keys into these data items).
Re: [PATCH] doc: Modify git-add doc to say "staging area"
On December 14, 2017 1:50:00 PM EST, Junio C Hamanowrote: >I agree with that. I do not consider the proposed change "good". Why is "index" better? It is a confusing name, one that has many other unrelated meanings. In particular, many projects managed by git also have an index, but few have a staging area. Also, the phrase "staging area" is already in use, so this is not a new term (e.g., git-staging). --- David A.Wheeler
Re: [PATCH] doc: Modify git-add doc to say "staging area"
Stefan Bellerwrites: > Anyway I think spending list band width on good documentation is > not bandwidth wasted. I agree with that. I do not consider the proposed change "good".
Re: [PATCH] doc: Modify git-add doc to say "staging area"
On Thu, Dec 14, 2017 at 10:08 AM, Junio C Hamanowrote: > Ævar Arnfjörð Bjarmason writes: > >> On Wed, Dec 13, 2017 at 6:46 AM, David A. Wheeler >> wrote: >>> On December 13, 2017 12:40:12 AM EST, Jacob Keller >>> wrote: I know we've used various terms for this concept across a lot of the documentation. However, I was under the impression that we most explicitly used "index" rather than "staging area". >>> >>> I think "staging area" is the better term. It focuses on its purpose, and >>> it is also less confusing ("index" and "cache" have other meanings in many >>> of the repos managed by git). >> >> After your patch the majority of the docs will still talk about >> "index", is this part of some larger series, perhaps it would be good >> to see it all at once... > > ... or none of it. I do not quite see a point of spending list > bandwidth on a change like this one. I think wording (as well as its consistency) in the documentation is rather important. Just the other day I was reading[1], yet another blog explaining why git sucks. TL;DR: (1) (a) The staging area is an advanced concept and should be disabled by default (b) and is documented super confusingly. (2) Branches and Remotes Management is Complex and Time-Consuming (3) its ecosystem (GitHub et al.) is not pushing for innovation, because "forks are not the right model". [1] https://gregoryszorc.com/blog/2017/12/11/high-level-problems-with-git-and-how-to-fix-them/ When I saw the original patch, I assumed it was a reaction to this blog and attempting to fix (1b), but maybe it is unrelated. Anyway I think spending list band width on good documentation is not bandwidth wasted. Stefan
Re: [PATCH] doc: Modify git-add doc to say "staging area"
Ævar Arnfjörð Bjarmasonwrites: > On Wed, Dec 13, 2017 at 6:46 AM, David A. Wheeler > wrote: >> On December 13, 2017 12:40:12 AM EST, Jacob Keller >> wrote: >>>I know we've used various terms for this concept across a lot of the >>>documentation. However, I was under the impression that we most >>>explicitly used "index" rather than "staging area". >> >> I think "staging area" is the better term. It focuses on its purpose, and it >> is also less confusing ("index" and "cache" have other meanings in many of >> the repos managed by git). > > After your patch the majority of the docs will still talk about > "index", is this part of some larger series, perhaps it would be good > to see it all at once... ... or none of it. I do not quite see a point of spending list bandwidth on a change like this one.
Re: [PATCH] doc: Modify git-add doc to say "staging area"
On Thu, Dec 14 2017, David A. Wheeler jotted: > On December 13, 2017 7:54:04 AM EST, "Ævar Arnfjörð Bjarmason" >wrote: >>After your patch the majority of the docs will still talk about >>"index", is this part of some larger series, perhaps it would be good >>to see it all at once... > > Yes, this would be part of a larger series. > > I'm happy to do the work, but I don't want to do it if it's just going to be > rejected. > > The work is very straightforward, in almost all cases you simply replace the > word index with the phrase staging area. The change is similar for the word > cache. So I'm not sure what seeing it all at once would do for anybody. > > Are there one or two other files that you would like to see transformed to > see as an example? If you're just looking for a sense of it, that should be > enough. No I get the idea, I'm just wondering if you'll continue to work on this, because if not mentioning "staging area" in more places without continuing to eradicate "index" isn't going to improve things much, and possibly make it worse. I like the direction of this series.
Re: [PATCH] doc: Modify git-add doc to say "staging area"
On December 13, 2017 7:54:04 AM EST, "Ævar Arnfjörð Bjarmason"wrote: >After your patch the majority of the docs will still talk about >"index", is this part of some larger series, perhaps it would be good >to see it all at once... Yes, this would be part of a larger series. I'm happy to do the work, but I don't want to do it if it's just going to be rejected. The work is very straightforward, in almost all cases you simply replace the word index with the phrase staging area. The change is similar for the word cache. So I'm not sure what seeing it all at once would do for anybody. Are there one or two other files that you would like to see transformed to see as an example? If you're just looking for a sense of it, that should be enough. --- David A.Wheeler
Re: [PATCH] doc: Modify git-add doc to say "staging area"
On Wed, 13 Dec 2017 09:02:42 -0800, Junio C Hamanowrote: > .. But that is not the only thing the index does. When "git merge" > finds conflicting changes, it adds the contents for common, our and > their variants to the index for the path. This is quite different > from how you use the index "as staging area"; the index is being > used as the "merging area". When "git clean" wants to see which > paths it finds on the filesystem are not of interest, it consults > the index, which acts as the list of paths that are of interest. If the phrase "staging area" is consistently used *instead* of index, there's no problem. E.g., "git clean consults the staging area" conveys exactly the same information as "git clean consults the index" when index == staging area. The term "index" has too many *other* meanings. --- David A. Wheeler
Re: [PATCH] doc: Modify git-add doc to say "staging area"
Jacob Kellerwrites: > I know we've used various terms for this concept across a lot of the > documentation. However, I was under the impression that we most > explicitly used "index" rather than "staging area". > > Additionally, I think there are many other locations which > consistently use "index" as the term already. Another reason why we would want to standardize in the other direction is because "X acts as Y" does not mean "X is Y". It is true that we (and also "newbie friendly" tutorials) often explain the index like so: "When working towards the next commit, you improve the contents a bit in the working tree, you 'git add' it to the index to make the contents of the index closer to what you want to have the next commit. The index works like the staging area." But that is not the only thing the index does. When "git merge" finds conflicting changes, it adds the contents for common, our and their variants to the index for the path. This is quite different from how you use the index "as staging area"; the index is being used as the "merging area". When "git clean" wants to see which paths it finds on the filesystem are not of interest, it consults the index, which acts as the list of paths that are of interest.
Re: [PATCH] doc: Modify git-add doc to say "staging area"
On Wed, Dec 13, 2017 at 6:46 AM, David A. Wheelerwrote: > On December 13, 2017 12:40:12 AM EST, Jacob Keller > wrote: >>I know we've used various terms for this concept across a lot of the >>documentation. However, I was under the impression that we most >>explicitly used "index" rather than "staging area". > > I think "staging area" is the better term. It focuses on its purpose, and it > is also less confusing ("index" and "cache" have other meanings in many of > the repos managed by git). After your patch the majority of the docs will still talk about "index", is this part of some larger series, perhaps it would be good to see it all at once...
Re: [PATCH] doc: Modify git-add doc to say "staging area"
On December 13, 2017 12:40:12 AM EST, Jacob Kellerwrote: >I know we've used various terms for this concept across a lot of the >documentation. However, I was under the impression that we most >explicitly used "index" rather than "staging area". I think "staging area" is the better term. It focuses on its purpose, and it is also less confusing ("index" and "cache" have other meanings in many of the repos managed by git). --- David A.Wheeler
Re: [PATCH] doc: Modify git-add doc to say "staging area"
On Tue, Dec 12, 2017 at 6:32 PM, David A. Wheelerwrote: > Change the documentation of git-add so that it consistently uses > the phrase "staging area". The current git documentation uses > inconsistent terminology ("index", "cache", and "staging area"). > This commit switches git-add's documentation to consistently use > the phrase "staging area", which is higher-level and should be less > confusing for new users. > I know we've used various terms for this concept across a lot of the documentation. However, I was under the impression that we most explicitly used "index" rather than "staging area". Additionally, I think there are many other locations which consistently use "index" as the term already. Thanks, Jake
[PATCH] doc: Modify git-add doc to say "staging area"
Change the documentation of git-add so that it consistently uses the phrase "staging area". The current git documentation uses inconsistent terminology ("index", "cache", and "staging area"). This commit switches git-add's documentation to consistently use the phrase "staging area", which is higher-level and should be less confusing for new users. Signed-off-by: David A. Wheeler--- Documentation/git-add.txt | 104 -- 1 file changed, 54 insertions(+), 50 deletions(-) diff --git a/Documentation/git-add.txt b/Documentation/git-add.txt index d50fa339d..927a152b0 100644 --- a/Documentation/git-add.txt +++ b/Documentation/git-add.txt @@ -3,7 +3,7 @@ git-add(1) NAME -git-add - Add file contents to the index +git-add - Add file contents to the staging area SYNOPSIS @@ -15,23 +15,24 @@ SYNOPSIS DESCRIPTION --- -This command updates the index using the current content found in -the working tree, to prepare the content staged for the next commit. -It typically adds the current content of existing paths as a whole, +This command updates the staging area using the current content found +in the working tree. +This command typically adds the current content of existing paths as a whole, but with some options it can also be used to add content with only part of the changes made to the working tree files applied, or remove paths that do not exist in the working tree anymore. -The "index" holds a snapshot of the content of the working tree, and it -is this snapshot that is taken as the contents of the next commit. Thus -after making any changes to the working tree, and before running -the commit command, you must use the `add` command to add any new or -modified files to the index. +The staging area (historically called the "index" or "cache") +holds a snapshot of the content of the working tree, and it +is this snapshot that is taken by default as the contents of the next commit. +Thus after making any changes to the working tree, and before running +the commit command, you can use the `add` command to add any new or +modified files to the staging area. This command can be performed multiple times before a commit. It only adds the content of the specified file(s) at the time the add command is run; if you want subsequent changes included in the next commit, then -you must run `git add` again to add the new content to the index. +you must run `git add` again to add the new content to the staging area. The `git status` command can be used to obtain a summary of which files have changes that are staged for the next commit. @@ -45,7 +46,9 @@ be used to add ignored files with the `-f` (force) option. Please see linkgit:git-commit[1] for alternative ways to add content to a commit. - +For example, you can use the git commit `-a` option to first automatically +add to the staging area all the files that have been have been +modified or deleted in the working tree. OPTIONS --- @@ -53,7 +56,7 @@ OPTIONS Files to add content from. Fileglobs (e.g. `*.c`) can be given to add all matching files. Also a leading directory name (e.g. `dir` to add `dir/file1` - and `dir/file2`) can be given to update the index to + and `dir/file2`) can be given to update the staging area to match the current state of the directory as a whole (e.g. specifying `dir` will record not just a file `dir/file1` modified in the working tree, a file `dir/file2` added to @@ -81,16 +84,16 @@ in linkgit:gitglossary[7]. -i:: --interactive:: Add modified contents in the working tree interactively to - the index. Optional path arguments may be supplied to limit + the staging area. Optional path arguments may be supplied to limit operation to a subset of the working tree. See ``Interactive mode'' for details. -p:: --patch:: - Interactively choose hunks of patch between the index and the - work tree and add them to the index. This gives the user a chance + Interactively choose hunks of patch between the staging area and the + work tree and add them to the staging area. This gives the user a chance to review the difference before adding modified contents to the - index. + staging area. + This effectively runs `add --interactive`, but bypasses the initial command menu and directly jumps to the `patch` subcommand. @@ -98,20 +101,20 @@ See ``Interactive mode'' for details. -e:: --edit:: - Open the diff vs. the index in an editor and let the user + Open the diff vs. the staging area in an editor and let the user edit it. After the editor was closed, adjust the hunk headers - and apply the patch to the index. + and apply the patch to the staging area. + The intent of this option is to pick and choose lines of the patch to apply, or even to modify the contents