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

Re: git switch/restore, still experimental?

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
May 10, 2021, 10:58 UTC
Message-ID
<8735uuvois.fsf@evledraar.gmail.com>
In-Reply-To
<609465b55e183_577f20852@natae.notmuch>
On Thu, May 06 2021, Felipe Contreras wrote:
> Ævar Arnfjörð Bjarmason wrote:
>> On Thu, May 06 2021, Felipe Contreras wrote:

First of all, I think we're in rather violent agreement about the real matter at hand here, and are at best talking about the design of the keychain for the bikeshed...

Show 16 quoted lines
>> > If you use natural language:
>> >
>> >   1. Git, switch to a new branch
>> >
>> >   2. Git, switch, create, branch
>> >
>> > One of these simply flows, the other is complete gibberish. I think
>> > anyone familiar with English can identify which is which.
>> 
>> Well, there's "Git, create a new branch and switch to it"
>
> Which command is that?
>
>   git create branch --checkout?
>
> I'm following the order of the words from left to right.

I'm just pointing out that git in general and certainly not the *nix tradition it follows tries to make commands readable in anything like English sentence order. If you attempt to read "log", "status", "rebase" etc. commands like that you'll at best end up sounding somewhat like Yoda.

Show 26 quoted lines
>> Also, there's the verb "make" in common use in git's command set
>> e.g. git-mktag, git-mktree, as well as mkdir(1), mkfifo(1) etc.
>
> Sure, although I wouldn't consider them main commands. I for one never
> use them.
>
>> In any case, unless we're talking about rewamping git's entire command
>> set (e.g. having a git-newtree or whatever) I'd like to think that it's
>> more productive to focus on making the commands/switches we have
>> internally consistent when possible, which is what I'm advocating in the
>> E-Mail that started this sub-thread.
>
> But we are talking about a new command, it is precisely at this point we
> need to think about what could have been if mistakes of the past had not
> happened.
>
> We should not repeat past mistakes without a very good reason.
>
> I don't think we should seek consistency for consistency's sake. Sure,
> consistency is good, but it's only one of many considerations.
>
> In this case however we have a rare occasion in which both consistency and
> natural language meet, we should not squander it.
>
> In fact, to be even more consistent we could add a -n option to git
> branch, which would be reduntant but more explicit, like --list.

Indeed, I agree with all of that. I.e. we should move to "switch" to "-n" instead of "-c" etc., and add a "-n" to "branch" for consistency. After all that's my upthread proposal...

I just don't think it's worth trying to make the argv readable as a sentence, even if we had no backwards compatibility to worry about.

Previous: Felipe ContrerasNext: Felipe Contreras
Message 20 of 25 in “git switch/restore, still experimental?”
  1. Gábor FarkasMay 4, 2021
  2. Felipe ContrerasMay 4, 2021
  3. Elijah NewrenMay 5, 2021
  4. Eric SunshineMay 5, 2021
  5. Ævar Arnfjörð BjarmasonMay 5, 2021
  6. Felipe ContrerasMay 5, 2021
  7. Sergey OrganovMay 5, 2021
  8. Sergey OrganovMay 5, 2021
  9. Junio C HamanoMay 6, 2021
  10. Sergey OrganovMay 6, 2021
  11. Ævar Arnfjörð BjarmasonMay 6, 2021
  12. Sergey OrganovMay 6, 2021
  13. Junio C HamanoMay 6, 2021
  14. Ævar Arnfjörð BjarmasonMay 6, 2021
  15. Ævar Arnfjörð BjarmasonMay 10, 2021
  16. Junio C HamanoMay 10, 2021
  17. Felipe ContrerasMay 6, 2021
  18. Ævar Arnfjörð BjarmasonMay 6, 2021
  19. Felipe ContrerasMay 6, 2021
  20. Ævar Arnfjörð BjarmasonMay 10, 2021
  21. Felipe ContrerasMay 11, 2021
  22. Johannes SchindelinMay 5, 2021
  23. Randall S. BeckerMay 5, 2021
  24. Junio C HamanoMay 6, 2021
  25. Felipe ContrerasMay 5, 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.