git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: A few usability question about git diff --cached

From
Wincent Colaiuta <win@wincent.com>
Date
Oct 4, 2007, 14:09 UTC
Message-ID
<5159468E-C263-4F7B-AEBA-8392C4742C47@wincent.com>
In-Reply-To
<7vy7ej9g38.fsf@gitster.siamese.dyndns.org>
El 4/10/2007, a las 15:14, Junio C Hamano escribió:
Show 21 quoted lines
> Miklos Vajna <vmiklos@frugalware.org> writes:
>
>> On Thu, Oct 04, 2007 at 02:27:41PM +0200, Paolo Ciarrocchi  
>> <paolo.ciarrocchi@gmail.com> wrote:
>>> Why do we have the option "--cached" and not "--index"?
>>
>> according to glossary.txt, 'cache' is an obsolete for 'index'.  
>> probably
>> this is the reason
>>
>> probably cache.h will be never renamed to index.h, i don't know if  
>> diff
>> --cached will be ever renamed to diff --index
>
> Probably never.
>
> Some commands support both --index and --cached and have
> different meanings.  For them,
>
>  * --index means work on both index and work tree;
>  * --cached means work only on index and ignore work tree.

Look at that with fresh eyes and you can see how it makes very little sense.

The option named "--index" works on more than the index and the option named "--cached" works only on the index. This sounds back-to- front.

IMO, better names would be:

--index : means work only on the index (and ignore the work tree); ie. it means what it says

--index-and-worktree : it also means what it says
The latter is more keystrokes but it's clearer.

Having said all this, I recognize that the likelihood of these option names ever being changed is close to zero. Like Paolo says in his other email, the documentation could be made clearer to avoid possible confusion.

Cheers, Wincent

Previous: Paolo CiarrocchiNext: Johannes Schindelin
Message 10 of 20 in “A few usability question about git diff --cached”
  1. Paolo CiarrocchiOct 4, 2007
  2. Wincent ColaiutaOct 4, 2007
  3. Miles BaderOct 5, 2007
  4. Wincent ColaiutaOct 5, 2007
  5. Miles BaderOct 5, 2007
  6. Miklos VajnaOct 4, 2007
  7. Paolo CiarrocchiOct 4, 2007
  8. Junio C HamanoOct 4, 2007
  9. Paolo CiarrocchiOct 4, 2007
  10. Wincent ColaiutaOct 4, 2007
  11. Johannes SchindelinOct 4, 2007
  12. Junio C HamanoOct 4, 2007
  13. David KastrupOct 4, 2007
  14. Matthieu MoyOct 4, 2007
  15. J. Bruce FieldsOct 4, 2007
  16. Matthieu MoyOct 4, 2007
  17. J. Bruce FieldsOct 4, 2007
  18. Matthieu MoyOct 5, 2007
  19. David TweedOct 5, 2007
  20. Wincent ColaiutaOct 4, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.