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

Re: EasyGit Integration

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Jun 11, 2009, 00:18 UTC
Message-ID
<94a0d4530906101718r4bd6b127y40e6e524afc5f38f@mail.gmail.com>
In-Reply-To
<alpine.LFD.2.01.0906101555590.6847@localhost.localdomain>

On Thu, Jun 11, 2009 at 2:04 AM, Linus Torvalds<torvalds@linux-foundation.org> wrote:

Show 35 quoted lines
>
>
> On Thu, 11 Jun 2009, Felipe Contreras wrote:
>
>> On Wed, Jun 10, 2009 at 7:03 AM, Linus
>> Torvalds<torvalds@linux-foundation.org> wrote:
>> >
>> >
>> > On Tue, 9 Jun 2009, Theodore Tso wrote:
>> >>
>> >> My personal opinion is this kind of overloading is actually more
>> >> confusing than simply adding a new name, such as "git revert-file".
>> >
>> > I'd agree, except I think it actually worked pretty well in "git
>> > checkout".
>> >
>> > The alternative was to add yet another command for that, or to teach
>> > people about the internal commands we did have. Adding the capability for
>> > checkout to check out individual files - in addition to commits and
>> > branches - I think worked pretty well.
>>
>> Why? What makes 'git checkout <commit>' and 'git checkout <commit> --
>> <path>' similar at all? I would expect 'git checkout <commit>' to be
>> the same as 'git checkout <commit> -- .'
>
> You don't understand.
>
> "git checkout" would be similar to "git revert", if we did that change.
>
> IOW, both would be "if you give it a commit, it acts at a commit level",
> and "if you give it pathnames, it acts on a pathname level".
>
> That is totally obvious, and not in the least confusing. They are two
> different things, but at the same time, there is no question about which
> is which.

I'm opposed to 'git revert -- <path>' for many reasons, one of which is; you might want to grab some files that are in a future commit. Reverting to the future is weird, unless you did a previous revert backwards.

I do understand the two different 'git checkout' modes, that's not the point, my point is the question you didn't answer; what does 'git checkout <commit>' and 'git checkout -- <path>' have in common?

To me it seems the only thing they have in common is the name.
Show 14 quoted lines
>> In my mind these are 2 completely different commands.
>
> They are two different things, but they both make sense within the
> _context_.
>
> Only earthworms and FOX news have no concept of "in context". So it does
> make sense to say "git checkout filename" (and expect it to check out that
> _filename_ - surprise surprise), and also say "git checkout branch" (and
> expect it to check out that branch - again, big surprise).
>
> Humans are generally _very_ good at seeing the same word in two different
> contexts, and not being confused at all. There is no confusion when I talk
> about SCM's in the context of git, even though "SCM" could also mean a
> Sceme interpreter, or "Saskatchewan College of Midwives".

Suppose you have a 'debian' branch, and a 'debian' directory, what does this command do? git checkout debian

Sure, I'm not an earthworm, so I can guess that command means checkout the debian branch because it's a much more common action. But git doesn't know that, you need to do: git checkout debian --

If I know I want to checkout a branch I would like to do: git <command to checkout a branch> debian

Show 8 quoted lines
> In fact, it is often *much* better to accept context-awareness, than to
> try too hard to be "uniquely identifying" even without context.
>
> Of course, you do want things to also be unambiguous. But that's why we
> have things like that "--" thing, when we want to specify pathspecs
> explicitly and don't want to accept any kind of ambiguity. Most humans
> tend to leave them out, and that "--" thing shows up mostly in git
> scripts.

Yeah, unless git finds it ambiguous and the user is forced to learn a new idiom in order to get rid of the ambiguity.

-- 
Felipe Contreras
Previous: Björn SteinbrinkNext: Elijah Newren
Message 36 of 49 in “EasyGit Integration”
  1. Scott ChaconJun 9, 2009
  2. Nicolas PitreJun 9, 2009
  3. Avery PennarunJun 9, 2009
  4. Björn SteinbrinkJun 9, 2009
  5. Avery PennarunJun 9, 2009
  6. Björn SteinbrinkJun 10, 2009
  7. Elijah NewrenJun 9, 2009
  8. Miles BaderJun 10, 2009
  9. Björn SteinbrinkJun 9, 2009
  10. Elijah NewrenJun 9, 2009
  11. Björn SteinbrinkJun 9, 2009
  12. Björn SteinbrinkJun 9, 2009
  13. Junio C HamanoJun 9, 2009
  14. Elijah NewrenJun 9, 2009
  15. Elijah NewrenJun 9, 2009
  16. Matthieu MoyJun 10, 2009
  17. Linus TorvaldsJun 9, 2009
  18. Elijah NewrenJun 9, 2009
  19. Linus TorvaldsJun 9, 2009
  20. Mark LodatoJun 10, 2009
  21. Miles BaderJun 10, 2009
  22. Theodore TsoJun 10, 2009
  23. Linus TorvaldsJun 10, 2009
  24. Felipe ContrerasJun 10, 2009
  25. Linus TorvaldsJun 10, 2009
  26. Scott ChaconJun 10, 2009
  27. Jakub NarebskiJun 11, 2009
  28. Felipe ContrerasJun 11, 2009
  29. Jakub NarebskiJun 11, 2009
  30. Felipe ContrerasJun 12, 2009
  31. Jakub NarebskiJun 12, 2009
  32. Felipe ContrerasJun 12, 2009
  33. Jakub NarebskiJun 12, 2009
  34. Felipe ContrerasJun 12, 2009
  35. Björn SteinbrinkJun 13, 2009
  36. Felipe ContrerasJun 11, 2009
  37. Elijah NewrenJun 10, 2009
  38. Matthieu MoyJun 10, 2009
  39. Sam VilainJun 10, 2009
  40. Linus TorvaldsJun 10, 2009
  41. Junio C HamanoJun 10, 2009
  42. Sam VilainJun 10, 2009
  43. Jakub NarebskiJun 10, 2009
  44. Nicolas PitreJun 10, 2009
  45. Junio C HamanoJun 10, 2009
  46. Elijah NewrenJun 10, 2009
  47. Scott ChaconJun 10, 2009
  48. Felipe ContrerasJun 10, 2009
  49. Felipe ContrerasJun 10, 2009

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.