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

Re: Better handling of local changes in 'gitk'?

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 12, 2007, 20:48 UTC
Message-ID
<7vejjdtkl0.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<7vir8ptksi.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <gitster@pobox.com> writes:
Show 21 quoted lines
> Linus Torvalds <torvalds@linux-foundation.org> writes:
>
>> I like how gitk shows the local changes as an unnamed commit at the top, 
>> but what I *don't* like is how it just ignored the difference between 
>> stuff that has been added to the index, and stuff that hasn't..
>>
>> It would be very nice to have *two* such commits (either or both of which 
>> just disappear), where the top-most is the diff to the index, and the 
>> second is the diff from the index to HEAD.
>>
>> That would not only be useful in general, it would be a wonderful way to 
>> visually introduce people to the notion of what the staging area is all 
>> about.
>
> Interesting, as I was thinking about something similar when I
> typed "git show stash" by mistake. I meant to say "git stash
> show", but "git show stash" output actually was even closer to
> what I wanted to see.
>
> "git stash" internally creates two commits, based on your HEAD:
> ...

Clarification. I do not mean gitk should create such a view using git-stash (for one thing that would nuke your local modifications after saving it away). I just meant that I agree with you that --cc between HEAD, index and the working tree is a wonderful way to view the current state.

It might make sense to teach "git diff" itself to show this 3-way diff with a new option ("git diff --h-i-w"). The necessary machinery is already there to handle "git diff maint master next pu" (four trees!), and "git diff maint:Makefile master:Makefile next:Makefile" (three blobs).

Previous: Junio C HamanoNext: Linus Torvalds
Message 3 of 9 in “Better handling of local changes in 'gitk'?”
  1. Linus TorvaldsJul 12, 2007
  2. Junio C HamanoJul 12, 2007
  3. Junio C HamanoJul 12, 2007
  4. Linus TorvaldsJul 12, 2007
  5. Paul MackerrasJul 13, 2007
  6. Paul MackerrasJul 13, 2007
  7. Linus TorvaldsJul 13, 2007
  8. Johannes SixtJul 13, 2007
  9. Linus TorvaldsJul 13, 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.