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

Re: [RFC/PATCH 0/2] New 'stage' command

From
OAOctavio Alvarez <alvarezp@alvarezp.ods.org>
Date
Apr 7, 2009, 08:39 UTC
Message-ID
<op.ur0czewh4oyyg1@localhost.localdomain>
In-Reply-To
<7v8wmd46p9.fsf@gitster.siamese.dyndns.org>
On Mon, 06 Apr 2009 18:02:10 -0700, Junio C Hamano <gitster@pobox.com> wrote:
Show 12 quoted lines
> David Kågedal <davidk@lysator.liu.se> writes:
>
>>>    - when you want to work with both the index and the work tree at the
>>>      same time, you say STAGEANDWORKTREE (the same disambiguation  
>>> caveat
>>>      applies).
>>
>> No, where did this come from?
>
> "git apply STAGEANDWORKTREE this.patch".  I do not want "for diff you can
> use these metavariables to name two things compared, but you can do so
> only for diff".
That example is broken. git apply doesn't even take an arbitrary treeish.
>>> Think.  What does "git log STAGE" mean?  Can you explain why it does  
>>> not
>>> make any sense?

gitk actually does this. Even more, gitk shows them in this order: STAGE^ would be HEAD. WORKTREE^ would be STAGE.

Makes sense.
(Not that I think git log should do the same.)

The difference between git diff and git reset is that git diff should take a range of trees, not a range of commits as parameters. OTOH, git reset doesn't know or care about trees, it needs commits.

git checkout WORKTREE:file makes sense, even though it is useless, but that's why it git checout STAGE:file makes sense: it should accept any tree instead of a commit.

git apply doesn't even take commits. It *could* take trees if it automagically created a branch on the commit, though. Either that, or git-apply shouldn't exist at all.

It's similar with git reset. You wouldn't use STAGE or WORKTREE here because a commit is actually necessary, but according option names like: --stage --worktree --both --none are better than --hard, --soft and --mixed.

So, if the man page for git-reset says "commit-id" and the man page for git diff says "tree-id..tree-id", I don't see any kind of confusion. git checkout could too. git reset and git log are to say "commit-id", but support clearer options.

WORKTREE, STAGE are trees as commits are also trees, but not all trees are commits.

Previous: Junio C HamanoNext: Octavio Alvarez
Message 37 of 38 in “New 'stage' command”
  1. 0/2 New 'stage' commandFelipe Contreras, Apr 5, 2009
  2. 1/2 git: remote stageFelipe Contreras, Apr 5, 2009
  3. 2/2 Add new 'git stage' scriptFelipe Contreras, Apr 5, 2009
  4. Junio C HamanoApr 5, 2009
  5. Felipe ContrerasApr 5, 2009
  6. Junio C HamanoApr 5, 2009
  7. Junio C HamanoApr 5, 2009
  8. Felipe ContrerasApr 5, 2009
  9. Jay SoffianApr 5, 2009
  10. Felipe ContrerasApr 5, 2009
  11. 0/2 Re: New 'stage' commandNicolas Sebrecht, Apr 5, 2009
  12. Markus HeidelbergApr 5, 2009
  13. Felipe ContrerasApr 5, 2009
  14. Björn SteinbrinkApr 5, 2009
  15. Markus HeidelbergApr 5, 2009
  16. Björn SteinbrinkApr 6, 2009
  17. Markus HeidelbergApr 5, 2009
  18. Sverre RabbelierApr 5, 2009
  19. Johannes SchindelinApr 5, 2009
  20. Felipe ContrerasApr 6, 2009
  21. David AguilarApr 6, 2009
  22. Junio C HamanoApr 6, 2009
  23. David AguilarApr 6, 2009
  24. Junio C HamanoApr 6, 2009
  25. David KågedalApr 6, 2009
  26. David KågedalApr 6, 2009
  27. Junio C HamanoApr 6, 2009
  28. Felipe ContrerasApr 6, 2009
  29. Björn SteinbrinkApr 6, 2009
  30. Felipe ContrerasApr 7, 2009
  31. Johannes SchindelinApr 7, 2009
  32. Matthieu MoyApr 6, 2009
  33. Junio C HamanoApr 7, 2009
  34. Stefan KarpinskiApr 7, 2009
  35. Octavio AlvarezApr 7, 2009
  36. Junio C HamanoApr 7, 2009
  37. Octavio AlvarezApr 7, 2009
  38. Octavio AlvarezApr 7, 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.