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

Re: [PATCH 6/7] stage: add 'diff' subcommand

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Aug 11, 2021, 21:40 UTC
Message-ID
<611443ebea222_1ed62089f@natae.notmuch>
In-Reply-To
<162871314612.7067.6886805754107701040.git@grubix.eu>
Michael J Gruber wrote:
> Therefore, "git stage" as an alias to "git add" does not serve the purpose
> of establishing "staging area" very well, and "git stage --diff" shows
> exactly the problem with turning an "object-like item" into a "verb-like
> command".

But "stage" can be a noun in English too. Just like "branch" can be both a verb and a noun.

Show 5 quoted lines
> I still think it's very worthwhile to fantasize about a git which has
> only verb-like commands (such as diff, add, checkout, checkin) and a
> consistent way of specifying the objects to act upon (possibly amended
> by "git pluralnoun" being synonymous to "git ls noun" or similar
> convenience shortcuts).

There was a sub-thread in which we fantasized a consistent UI [1], and taking Mercurial as inspiration the way to fix some of the warts would be:

  git branch          # verb
  git branches new    # noun verb
  git branches delete # noun verb

Now, it's pretty unlikely that the inconsistencies with `git branch` will ever be fixed, but we can take that as guidance for the staging area:

  git stage               # verb
  git unstage             # verb
  git staging-area add    # noun verb
  git staging-area remove # noun verb
  git staging-area diff   # noun verb

This I think would be the most consistent way of implementing this, my only problem is that 'staging-area' is too long. Of course users could easily write aliases, but git should be easy to use by default.

If git implemented default aliases as I suggested [2], then I would have no problem with 'staging-area', because the user could simply do:

  git sa diff
But that's a very big *if*.
Cheers.

[1] https://lore.kernel.org/git/f0770358-be4c-a747-0851-b2fd73c1978e@mfriebe.de/ [2] http://lore.kernel.org/git/20210702100506.1422429-1-felipe.contreras@gmail.com

-- 
Felipe Contreras
Previous: Junio C HamanoNext: Felipe Contreras
Message 21 of 24 in “[un]stage: officially start moving to "staging area"”
  1. 0/7 [un]stage: officially start moving to "staging area"Felipe Contreras, Aug 11, 2021
  2. 1/7 stage: add proper 'stage' commandFelipe Contreras, Aug 11, 2021
  3. 2/7 stage: add helper to run commandsFelipe Contreras, Aug 11, 2021
  4. 3/7 stage: add 'add' subcommandFelipe Contreras, Aug 11, 2021
  5. 4/7 stage: add 'remove' subcommandFelipe Contreras, Aug 11, 2021
  6. 5/7 unstage: add 'unstage' commandFelipe Contreras, Aug 11, 2021
  7. 6/7 stage: add 'diff' subcommandFelipe Contreras, Aug 11, 2021
  8. Bagas SanjayaAug 11, 2021
  9. Felipe ContrerasAug 11, 2021
  10. Junio C HamanoAug 11, 2021
  11. Felipe ContrerasAug 11, 2021
  12. Jeff KingAug 11, 2021
  13. Felipe ContrerasAug 11, 2021
  14. Jeff KingAug 11, 2021
  15. Felipe ContrerasAug 11, 2021
  16. Michael J GruberAug 11, 2021
  17. Jeff KingAug 11, 2021
  18. Michael J GruberAug 11, 2021
  19. Jeff KingAug 11, 2021
  20. Junio C HamanoAug 11, 2021
  21. Felipe ContrerasAug 11, 2021
  22. 7/7 stage: add 'edit' commandFelipe Contreras, Aug 11, 2021
  23. Michael J GruberAug 11, 2021
  24. Felipe ContrerasAug 11, 2021

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.