{"thread":{"id":"10138","subject":"A few usability question about git diff --cached","startedAt":"2007-10-04T12:27:41Z","lastAt":"2007-10-05T10:41:37Z","messageCount":20,"participants":["Paolo Ciarrocchi","Wincent Colaiuta","Miklos Vajna","Junio C Hamano","Johannes Schindelin","Matthieu Moy","David Kastrup","J. Bruce Fields","David Tweed","Miles Bader"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"54811","messageId":"4d8e3fd30710040527j61152b2dh1b073504ba19d490@mail.gmail.com","threadId":"10138","inReplyTo":null,"subject":"A few usability question about git diff --cached","fromName":"Paolo Ciarrocchi","fromEmail":"paolo.ciarrocchi@gmail.com","sentAt":"2007-10-04T12:27:41Z","receivedAt":"2007-10-04T12:27:41Z","isPatch":false,"sender":{"key":"paolo.ciarrocchi@gmail.com","avatar":null},"body":"Hi all,\nI'm having and interesting discussion with an happy mercurial users\nwhich started reading the git documentation. He raised aquestion that\nI'm not able to answer:\n\n> $ git diff --cached\n>\n> (Without —cached, git-diff(1) will show you any changes that you've\n> made but not yet added to the index.) You can also get a brief summary\n> of the situation with git-status(1):\n\nWhy do we have the option \"--cached\" and not \"--index\"?\n\nI believe that, just reading the documentation, is not very easy to\nfully understand the role of the index and then we have an option\n\"--cached\" that refers to the index.\nIs it a good idea to add and document an option \"--index\" and remove\nfrom the doc the option \"--cached\"?\n\nThanks.\n\nRegards,\n-- \nPaolo\nhttp://paolo.ciarrocchi.googlepages.com/\n"},{"id":"54815","messageId":"5ACC5CA7-8314-4035-94EC-190138A25EBD@wincent.com","threadId":"10138","inReplyTo":"4d8e3fd30710040527j61152b2dh1b073504ba19d490@mail.gmail.com","subject":"Re: A few usability question about git diff --cached","fromName":"Wincent Colaiuta","fromEmail":"win@wincent.com","sentAt":"2007-10-04T12:54:31Z","receivedAt":"2007-10-04T12:54:31Z","isPatch":false,"sender":{"key":"greg@hurrell.net","avatar":"https://avatars.githubusercontent.com/u/7074?v=4"},"body":"El 4/10/2007, a las 14:27, Paolo Ciarrocchi escribió:\n\n> Hi all,\n> I'm having and interesting discussion with an happy mercurial users\n> which started reading the git documentation. He raised aquestion that\n> I'm not able to answer:\n>\n>> $ git diff --cached\n>>\n>> (Without —cached, git-diff(1) will show you any changes that you've\n>> made but not yet added to the index.) You can also get a brief  \n>> summary\n>> of the situation with git-status(1):\n>\n> Why do we have the option \"--cached\" and not \"--index\"?\n\nI am not an \"old timer\", but I believe that it's because what we now  \nknow as \"the index\" was original called \"the cache\". See:\n\n<http://git.or.cz/gitwiki/GitHistory>\n\nYou're probably right that the option name is confusing, I guess  \nchanging it to \"--index\" would be a good idea, continuing to support  \n\"--cached\" but marking it as deprecated before finally removing it at  \nsome point in the future.\n\nCheers,\nWincent\n"},{"id":"54816","messageId":"20071004125641.GE15339@genesis.frugalware.org","threadId":"10138","inReplyTo":"4d8e3fd30710040527j61152b2dh1b073504ba19d490@mail.gmail.com","subject":"Re: A few usability question about git diff --cached","fromName":"Miklos Vajna","fromEmail":"vmiklos@frugalware.org","sentAt":"2007-10-04T12:56:41Z","receivedAt":"2007-10-04T12:56:41Z","isPatch":false,"sender":{"key":"vmiklos@frugalware.org","avatar":"https://gravatar.com/avatar/401c1cbbb3a5d13e650c691a2c71d6fd0b80df1a01bc74d9f1972675dd58f2bd?d=mp&s=160"},"body":"On Thu, Oct 04, 2007 at 02:27:41PM +0200, Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com> wrote:\n> Why do we have the option \"--cached\" and not \"--index\"?\n\naccording to glossary.txt, 'cache' is an obsolete for 'index'. probably\nthis is the reason\n\nprobably cache.h will be never renamed to index.h, i don't know if diff\n--cached will be ever renamed to diff --index\n\n- VMiklos\n"},{"id":"54818","messageId":"4d8e3fd30710040610m49521fb7ld8f95043c945bf94@mail.gmail.com","threadId":"10138","inReplyTo":"20071004125641.GE15339@genesis.frugalware.org","subject":"Re: A few usability question about git diff --cached","fromName":"Paolo Ciarrocchi","fromEmail":"paolo.ciarrocchi@gmail.com","sentAt":"2007-10-04T13:10:45Z","receivedAt":"2007-10-04T13:10:45Z","isPatch":false,"sender":{"key":"paolo.ciarrocchi@gmail.com","avatar":null},"body":"On 10/4/07, Miklos Vajna <vmiklos@frugalware.org> wrote:\n> On Thu, Oct 04, 2007 at 02:27:41PM +0200, Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com> wrote:\n> > Why do we have the option \"--cached\" and not \"--index\"?\n>\n> according to glossary.txt, 'cache' is an obsolete for 'index'. probably\n> this is the reason\n>\n> probably cache.h will be never renamed to index.h, i don't know if diff\n> --cached will be ever renamed to diff --index\n\nBelieve me, for a GIT newbie git --cached is confusing.\n\nThat user started reading \"A tutorial introduction to git (for version\n1.5.1 or newer)\",\nafter a cuple of minutes of reading he reached \"Making changes\" saw:\n\n\" You are now ready to commit. You can see what is about to be\ncommitted using git-diff(1) with the —cached option:\n\n$ git diff --cached \"\n\n$ git diff --index sound a lof more consistent with the general documentation.\n\nRegards,\n-- \nPaolo\nhttp://paolo.ciarrocchi.googlepages.com/\nhttp://ubuntista.blogspot.com\n"},{"id":"54820","messageId":"7vy7ej9g38.fsf@gitster.siamese.dyndns.org","threadId":"10138","inReplyTo":"20071004125641.GE15339@genesis.frugalware.org","subject":"Re: A few usability question about git diff --cached","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-10-04T13:14:51Z","receivedAt":"2007-10-04T13:14:51Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Miklos Vajna <vmiklos@frugalware.org> writes:\n\n> On Thu, Oct 04, 2007 at 02:27:41PM +0200, Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com> wrote:\n>> Why do we have the option \"--cached\" and not \"--index\"?\n>\n> according to glossary.txt, 'cache' is an obsolete for 'index'. probably\n> this is the reason\n>\n> probably cache.h will be never renamed to index.h, i don't know if diff\n> --cached will be ever renamed to diff --index\n\nProbably never.\n\nSome commands support both --index and --cached and have\ndifferent meanings.  For them,\n\n * --index means work on both index and work tree;\n * --cached means work only on index and ignore work tree.\n\nIn the case of \"diff --cached\", the latter is exactly what's\nhappening.  We do not say \"git diff-index --index $commit\"\nbecause \"git diff-index\" (and by extension, when you give only\none commit to \"git diff\" as parameter) is all about a commit vs\nyour uncommitted changes, so having you say \"--index\" is just\nsilly.  \"git diff --cached\" is just a shorthand for \"git diff\n--cached HEAD\".  Because --cached would make sense to no other\nform of diff, its presense by definition means you are talking\nabout the one-tree form of diff i.e. compare a commit with your\nuncommitted changes.\n\nAn example of a command that supports both is \"git apply\".\nActually it is an extreme case in that it allows \"no index\" form\nof operation, so it has \"git apply\", \"git apply --cached\", and\n\"git apply --index\".  The --cached would only apply to index\nwithout touching work tree, the --index would apply to both\nindex and work tree.\n"},{"id":"54823","messageId":"4d8e3fd30710040639x62d7b9cbr688aca141849212c@mail.gmail.com","threadId":"10138","inReplyTo":"7vy7ej9g38.fsf@gitster.siamese.dyndns.org","subject":"Re: A few usability question about git diff --cached","fromName":"Paolo Ciarrocchi","fromEmail":"paolo.ciarrocchi@gmail.com","sentAt":"2007-10-04T13:39:01Z","receivedAt":"2007-10-04T13:39:01Z","isPatch":false,"sender":{"key":"paolo.ciarrocchi@gmail.com","avatar":null},"body":"On 10/4/07, Junio C Hamano <gitster@pobox.com> wrote:\n> Miklos Vajna <vmiklos@frugalware.org> writes:\n>\n> > On Thu, Oct 04, 2007 at 02:27:41PM +0200, Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com> wrote:\n> >> Why do we have the option \"--cached\" and not \"--index\"?\n> >\n> > according to glossary.txt, 'cache' is an obsolete for 'index'. probably\n> > this is the reason\n> >\n> > probably cache.h will be never renamed to index.h, i don't know if diff\n> > --cached will be ever renamed to diff --index\n>\n> Probably never.\n\nOuch!\n\n> Some commands support both --index and --cached and have\n> different meanings.  For them,\n>\n>  * --index means work on both index and work tree;\n>  * --cached means work only on index and ignore work tree.\n>\n> In the case of \"diff --cached\", the latter is exactly what's\n> happening.  We do not say \"git diff-index --index $commit\"\n> because \"git diff-index\" (and by extension, when you give only\n> one commit to \"git diff\" as parameter) is all about a commit vs\n> your uncommitted changes, so having you say \"--index\" is just\n> silly.  \"git diff --cached\" is just a shorthand for \"git diff\n> --cached HEAD\".  Because --cached would make sense to no other\n> form of diff, its presense by definition means you are talking\n> about the one-tree form of diff i.e. compare a commit with your\n> uncommitted changes.\n\nI see. But the problem is real. If we cannot solve the problem\nchanging the code of git we'll need to avoid this kind of\nmisunderstanding having \"better\" documentation.\n\nAs soon as I'll find some spare time I'll propose a patch to \"A\ntutorial introduction to git (for version 1.5.1 or newer)\".\n\nThanks!\n\nRegards,\n-- \nPaolo\nhttp://paolo.ciarrocchi.googlepages.com/\nhttp://ubuntista.blogspot.com\n"},{"id":"54824","messageId":"5159468E-C263-4F7B-AEBA-8392C4742C47@wincent.com","threadId":"10138","inReplyTo":"7vy7ej9g38.fsf@gitster.siamese.dyndns.org","subject":"Re: A few usability question about git diff --cached","fromName":"Wincent Colaiuta","fromEmail":"win@wincent.com","sentAt":"2007-10-04T14:09:20Z","receivedAt":"2007-10-04T14:09:20Z","isPatch":false,"sender":{"key":"greg@hurrell.net","avatar":"https://avatars.githubusercontent.com/u/7074?v=4"},"body":"El 4/10/2007, a las 15:14, Junio C Hamano escribió:\n\n> Miklos Vajna <vmiklos@frugalware.org> writes:\n>\n>> On Thu, Oct 04, 2007 at 02:27:41PM +0200, Paolo Ciarrocchi  \n>> <paolo.ciarrocchi@gmail.com> wrote:\n>>> Why do we have the option \"--cached\" and not \"--index\"?\n>>\n>> according to glossary.txt, 'cache' is an obsolete for 'index'.  \n>> probably\n>> this is the reason\n>>\n>> probably cache.h will be never renamed to index.h, i don't know if  \n>> diff\n>> --cached will be ever renamed to diff --index\n>\n> Probably never.\n>\n> Some commands support both --index and --cached and have\n> different meanings.  For them,\n>\n>  * --index means work on both index and work tree;\n>  * --cached means work only on index and ignore work tree.\n\nLook at that with fresh eyes and you can see how it makes very little  \nsense.\n\nThe option named \"--index\" works on more than the index and the  \noption named \"--cached\" works only on the index. This sounds back-to- \nfront.\n\nIMO, better names would be:\n\n--index : means work only on the index (and ignore the work tree);  \nie. it means what it says\n\n--index-and-worktree : it also means what it says\n\nThe latter is more keystrokes but it's clearer.\n\nHaving said all this, I recognize that the likelihood of these option  \nnames ever being changed is close to zero. Like Paolo says in his  \nother email, the documentation could be made clearer to avoid  \npossible confusion.\n\nCheers,\nWincent\n"},{"id":"54825","messageId":"Pine.LNX.4.64.0710041534000.4174@racer.site","threadId":"10138","inReplyTo":"7vy7ej9g38.fsf@gitster.siamese.dyndns.org","subject":"Re: A few usability question about git diff --cached","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-10-04T14:34:45Z","receivedAt":"2007-10-04T14:34:45Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 4 Oct 2007, Junio C Hamano wrote:\n\n>  * --cached means work only on index and ignore work tree.\n\nI guess I could live with \"--staged\" as a synonym for \"--cached\" (and \nmaybe deprecating \"--cached\").\n\nCiao,\nDscho\n"},{"id":"54826","messageId":"7vhcl79c4l.fsf@gitster.siamese.dyndns.org","threadId":"10138","inReplyTo":"Pine.LNX.4.64.0710041534000.4174@racer.site","subject":"Re: A few usability question about git diff --cached","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-10-04T14:40:26Z","receivedAt":"2007-10-04T14:40:26Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> On Thu, 4 Oct 2007, Junio C Hamano wrote:\n>\n>>  * --cached means work only on index and ignore work tree.\n>\n> I guess I could live with \"--staged\" as a synonym for \"--cached\" (and \n> maybe deprecating \"--cached\").\n\nA handy mnemonic might be:\n\n * --index means work work tree through the index.  Once you get\n   git, this is natural as you would not interact with files in\n   the work tree that is not known to the index.\n\n * --cached means work only on the cached information in index.\n\nAny change like swapping them or renaming --cached to --index\nand making something else to mean what --index always meant will\nbreak existing setups and people's scripts.  Won't happen.\n\nGiving them synonyms without deprecation is a viable option, if\nnecessary.  I do not however see the need yet.  A few people who\nhaven't learned the lingo of the land yet can worry about\npossible confusion, but I do not think that \"worry\" itself does\nnot count as real need.\n"},{"id":"54827","messageId":"vpqtzp7ndn3.fsf@bauges.imag.fr","threadId":"10138","inReplyTo":"Pine.LNX.4.64.0710041534000.4174@racer.site","subject":"Re: A few usability question about git diff --cached","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2007-10-04T14:44:00Z","receivedAt":"2007-10-04T14:44:00Z","isPatch":false,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> Hi,\n>\n> On Thu, 4 Oct 2007, Junio C Hamano wrote:\n>\n>>  * --cached means work only on index and ignore work tree.\n>\n> I guess I could live with \"--staged\" as a synonym for \"--cached\" (and \n> maybe deprecating \"--cached\").\n\nIt makes more sense to me.\n\nFor me, a \"cache\" is a fast-access copy of something, that I can\nrebuild at any time. Cache should be only a matter of performance, if\nthe \"cache\" for an application changes its functionality, it means the\ncache has been too optimistic. Git's index is not that, \"git add\"\nmeans \"add this to the index\", which itself means \"put that in the\nlist of things to commit\", and not \"get a copy of that to work faster\nwith it\".\n\nSo, to me (non-native speaker), \"index\" doesn't mean much, \"cache\" is\nworse, it means something which isn't correct, and \"staging area\"\nmeans the right thing (but is longer to type). For example, I\nunderstand immediately when git-gui talks me about staging/unstaging\nchanges ;-).\n\n-- \nMatthieu\n"},{"id":"54831","messageId":"86hcl70wep.fsf@lola.quinscape.zz","threadId":"10138","inReplyTo":"7vhcl79c4l.fsf@gitster.siamese.dyndns.org","subject":"Re: A few usability question about git diff --cached","fromName":"David Kastrup","fromEmail":"dak@gnu.org","sentAt":"2007-10-04T14:47:10Z","receivedAt":"2007-10-04T14:47:10Z","isPatch":false,"sender":{"key":"dak@gnu.org","avatar":"https://avatars.githubusercontent.com/u/52141349?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n>  * --index means work work tree through the index.  Once you get\n>    git, this is natural as you would not interact with files in\n>    the work tree that is not known to the index.\n>\n>  * --cached means work only on the cached information in index.\n\nThat is a rather shaky relation.\n\n> Giving them synonyms without deprecation is a viable option, if\n> necessary.  I do not however see the need yet.  A few people who\n> haven't learned the lingo of the land yet can worry about possible\n> confusion, but I do not think that \"worry\" itself does not count as\n> real need.\n\nThe \"lingo of the land\" as documented in the manuals no longer uses\nthe term \"cache\" or \"cached\" as something with an official meaning.\n\nSo the current state of affairs does not really look overly convincing\nwith regard to consistency.\n\n-- \nDavid Kastrup\n"},{"id":"54842","messageId":"AB1F1C3D-DB5D-4ADB-ACA0-776508FAE97F@wincent.com","threadId":"10138","inReplyTo":"Pine.LNX.4.64.0710041534000.4174@racer.site","subject":"Re: A few usability question about git diff --cached","fromName":"Wincent Colaiuta","fromEmail":"win@wincent.com","sentAt":"2007-10-04T15:49:46Z","receivedAt":"2007-10-04T15:49:46Z","isPatch":false,"sender":{"key":"greg@hurrell.net","avatar":"https://avatars.githubusercontent.com/u/7074?v=4"},"body":"El 4/10/2007, a las 16:34, Johannes Schindelin escribió:\n\n> On Thu, 4 Oct 2007, Junio C Hamano wrote:\n>\n>>  * --cached means work only on index and ignore work tree.\n>\n> I guess I could live with \"--staged\" as a synonym for \"--cached\" (and\n> maybe deprecating \"--cached\").\n\nGood idea. I think that would partly address the consistency  \nproblems, be more accessible to new users, and easier to explain in  \nthe documentation.\n\nNot that it makes much difference to me personally. One of the first  \nthings I did when I started using Git was set up two shell aliases  \n(not Git aliases) seeing as looking at my staged and unstaged changes  \nis for me such an extremely frequent operation:\n\n   alias staged='git diff --cached'\n   alias unstaged='git diff'\n\nCheers,\nWincent\n"},{"id":"54840","messageId":"20071004155147.GA17487@fieldses.org","threadId":"10138","inReplyTo":"vpqtzp7ndn3.fsf@bauges.imag.fr","subject":"Re: A few usability question about git diff --cached","fromName":"J. Bruce Fields","fromEmail":"bfields@fieldses.org","sentAt":"2007-10-04T15:51:47Z","receivedAt":"2007-10-04T15:51:47Z","isPatch":false,"sender":{"key":"bfields@citi.umich.edu","avatar":null},"body":"On Thu, Oct 04, 2007 at 04:44:00PM +0200, Matthieu Moy wrote:\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> > Hi,\n> >\n> > On Thu, 4 Oct 2007, Junio C Hamano wrote:\n> >\n> >>  * --cached means work only on index and ignore work tree.\n> >\n> > I guess I could live with \"--staged\" as a synonym for \"--cached\" (and \n> > maybe deprecating \"--cached\").\n> \n> It makes more sense to me.\n> \n> For me, a \"cache\" is a fast-access copy of something, that I can\n> rebuild at any time. Cache should be only a matter of performance, if\n> the \"cache\" for an application changes its functionality, it means the\n> cache has been too optimistic. Git's index is not that, \"git add\"\n> means \"add this to the index\", which itself means \"put that in the\n> list of things to commit\", and not \"get a copy of that to work faster\n> with it\".\n\nYes, the index differs from the work tree or HEAD temporarily, but most\nof it's life it's just a fast-access copy of something that you can\nrebuild at any time.\n\nSo it's partly a \"cache\", partly a \"staging area\", and \"index\" is as\ngood a term for it as any.\n\n--b.\n"},{"id":"54845","messageId":"vpq8x6ix3zm.fsf@bauges.imag.fr","threadId":"10138","inReplyTo":"20071004155147.GA17487@fieldses.org","subject":"Re: A few usability question about git diff --cached","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2007-10-04T16:02:21Z","receivedAt":"2007-10-04T16:02:21Z","isPatch":false,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"\"J. Bruce Fields\" <bfields@fieldses.org> writes:\n\n> Yes, the index differs from the work tree or HEAD temporarily, \n\nTemporarily, yes, but the _point_ of having it is to have it differ\nfrom HEAD (otherwise, you can't create a new revision), and from the\ntree (otherwise, index-related commands are useless).\n\nThe stat-information, and sha1sum are actually a cache, but they don't\nhave to be user-visible, except for speed. \"diff --cached\" has nothing\nto do with the stat information for the user.\n\n-- \nMatthieu\n"},{"id":"54848","messageId":"20071004161935.GC17487@fieldses.org","threadId":"10138","inReplyTo":"vpq8x6ix3zm.fsf@bauges.imag.fr","subject":"Re: A few usability question about git diff --cached","fromName":"J. Bruce Fields","fromEmail":"bfields@fieldses.org","sentAt":"2007-10-04T16:19:35Z","receivedAt":"2007-10-04T16:19:35Z","isPatch":false,"sender":{"key":"bfields@citi.umich.edu","avatar":null},"body":"On Thu, Oct 04, 2007 at 06:02:21PM +0200, Matthieu Moy wrote:\n> \"J. Bruce Fields\" <bfields@fieldses.org> writes:\n> \n> > Yes, the index differs from the work tree or HEAD temporarily, \n> \n> Temporarily, yes, but the _point_ of having it is to have it differ\n> from HEAD (otherwise, you can't create a new revision), and from the\n> tree (otherwise, index-related commands are useless).\n\nGetting a nearly-instantaneous \"git diff\" would be sufficiently\nimportant to justify its existance on its own, so I think you're\noverstating the case.\n\n> The stat-information, and sha1sum are actually a cache, but they don't\n> have to be user-visible, except for speed.\n\nThat's a big exception.--b.\n\n> \"diff --cached\" has nothing to do with the stat information for the\n> user.\n"},{"id":"54904","messageId":"e1dab3980710042222u3e1fc21dtf4b90056fb36eaf0@mail.gmail.com","threadId":"10138","inReplyTo":"vpqtzp7ndn3.fsf@bauges.imag.fr","subject":"Re: A few usability question about git diff --cached","fromName":"David Tweed","fromEmail":"david.tweed@gmail.com","sentAt":"2007-10-05T05:22:18Z","receivedAt":"2007-10-05T05:22:18Z","isPatch":false,"sender":{"key":"david.tweed@gmail.com","avatar":null},"body":"On 10/4/07, Matthieu Moy <Matthieu.Moy@imag.fr> wrote:\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> It makes more sense to me.\n>\n> For me, a \"cache\" is a fast-access copy of something, that I can\n> rebuild at any time. Cache should be only a matter of performance, if\n> the \"cache\" for an application changes its functionality, it means the\n> cache has been too optimistic. Git's index is not that, \"git add\"\n> means \"add this to the index\", which itself means \"put that in the\n> list of things to commit\", and not \"get a copy of that to work faster\n> with it\".\n\nJust to say this interpretation is also the natural interpretation I\nhave for the term \"cached\", and it confused me no end when I was first\nlearning about git that the index was referred to as a cache. To be\nfair, git the documentation was in flux at that time and it's now\nreferred too as a cache in very few places now.\n\nAn example of the kind of thing I have to think carefully about even\nnow, Junio said in a different mail:\n\n\"--cached means work only on the \"cached information in index.\"\n\nIf I understand correctly, the term \"cached information in index\" is\nmore correctly \"stored information in index\" (or perhaps more\ntechnically \"staged information in index\") since there may be\ninformation in there which isn't a cache because it's no longer\npresent anywhere else (ie, not in a commit yet but also changed in the\nworking tree).\n\nIt's not a big thing, but the usage of cached in git still quite confuses me.\n\n-- \ncheers, dave tweed__________________________\ndavid.tweed@gmail.com\nRm 124, School of Systems Engineering, University of Reading.\n\"we had no idea that when we added templates we were adding a Turing-\ncomplete compile-time language.\" -- C++ standardisation committee\n"},{"id":"54905","messageId":"buoejga14qg.fsf@dhapc248.dev.necel.com","threadId":"10138","inReplyTo":"5ACC5CA7-8314-4035-94EC-190138A25EBD@wincent.com","subject":"Re: A few usability question about git diff --cached","fromName":"Miles Bader","fromEmail":"miles.bader@necel.com","sentAt":"2007-10-05T05:59:35Z","receivedAt":"2007-10-05T05:59:35Z","isPatch":false,"sender":{"key":"miles.bader@necel.com","avatar":"https://gravatar.com/avatar/be062d4050eb88e04229cbdb60f803e1bd647923a015996c2439e76f23e336a7?d=mp&s=160"},"body":"Wincent Colaiuta <win@wincent.com> writes:\n> You're probably right that the option name is confusing, I guess  \n> changing it to \"--index\" would be a good idea, continuing to support  \n> \"--cached\" but marking it as deprecated before finally removing it at  \n> some point in the future.\n\nPersonally all I want is a short-option alias for --cached!\n\nHopefully something easily type-able (not uppercase)...\n\n-Miles\n\n-- \nAmericans are broad-minded people.  They'll accept the fact that a person can\nbe an alcoholic, a dope fiend, a wife beater, and even a newspaperman, but if a\nman doesn't drive, there is something wrong with him.  -- Art Buchwald\n"},{"id":"54908","messageId":"vpqwsu2oyhj.fsf@bauges.imag.fr","threadId":"10138","inReplyTo":"20071004161935.GC17487@fieldses.org","subject":"Re: A few usability question about git diff --cached","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2007-10-05T06:40:40Z","receivedAt":"2007-10-05T06:40:40Z","isPatch":false,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"\"J. Bruce Fields\" <bfields@fieldses.org> writes:\n\n>> The stat-information, and sha1sum are actually a cache, but they don't\n>> have to be user-visible, except for speed.\n>\n> That's a big exception.--b.\n\nSpeed _is_ important, of course. But the user only benefits from\nspeed, he doesn't have to manipulate it explicitely. I may be\nrepeating myself, but \"diff --cached\" doesn't mean \"diff using the\nstat-cache\", it means \"diff using the cached _content_\", which is\nreally unrelated from the stat-cache.\n\nMercurial also has fast diff (perhaps a bit slower that git, but same\norder of magnitude), and has no user-visible index.\n\n-- \nMatthieu\n"},{"id":"54935","messageId":"0A7AA9C3-6D9E-4B14-822D-05232F0EAF99@wincent.com","threadId":"10138","inReplyTo":"buoejga14qg.fsf@dhapc248.dev.necel.com","subject":"Re: A few usability question about git diff --cached","fromName":"Wincent Colaiuta","fromEmail":"win@wincent.com","sentAt":"2007-10-05T10:27:24Z","receivedAt":"2007-10-05T10:27:24Z","isPatch":false,"sender":{"key":"greg@hurrell.net","avatar":"https://avatars.githubusercontent.com/u/7074?v=4"},"body":"El 5/10/2007, a las 7:59, Miles Bader escribió:\n\n> Wincent Colaiuta <win@wincent.com> writes:\n>> You're probably right that the option name is confusing, I guess\n>> changing it to \"--index\" would be a good idea, continuing to support\n>> \"--cached\" but marking it as deprecated before finally removing it at\n>> some point in the future.\n>\n> Personally all I want is a short-option alias for --cached!\n>\n> Hopefully something easily type-able (not uppercase)...\n\nDid you see the aliases I posted earlier in the thread? I can't think  \nof anything shorter or semantically clearer than \"staged\" and  \n\"unstaged\".\n\nCheers,\nWincent\n"},{"id":"54936","messageId":"fc339e4a0710050341v11a7f9f7j3cf24403d2231886@mail.gmail.com","threadId":"10138","inReplyTo":"0A7AA9C3-6D9E-4B14-822D-05232F0EAF99@wincent.com","subject":"Re: A few usability question about git diff --cached","fromName":"Miles Bader","fromEmail":"miles@gnu.org","sentAt":"2007-10-05T10:41:37Z","receivedAt":"2007-10-05T10:41:37Z","isPatch":false,"sender":{"key":"miles@gnu.org","avatar":"https://gravatar.com/avatar/01069b69593af7bff28e2f97afeb3644ae6fe2f5f56cb3a8cf34c5fb8c36efe5?d=mp&s=160"},"body":"On 10/5/07, Wincent Colaiuta <win@wincent.com> wrote:\n> > Personally all I want is a short-option alias for --cached!\n> >\n> > Hopefully something easily type-able (not uppercase)...\n>\n> Did you see the aliases I posted earlier in the thread? I can't think\n> of anything shorter or semantically clearer than \"staged\" and\n> \"unstaged\".\n\nThe words are ok, I guess, but aliases are not a replacement for short\noptions.... really all frequently used, non-dangerous, options should\nhave a short variant (and diff --cached meets both criteria handily)!\n\n-Miles\n-- \nDo not taunt Happy Fun Ball.\n"}]}