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

Re: [PATCH] Revert "Declare both git-switch and git-restore experimental"

From
MMartin <lists@mfriebe.de>
Date
Feb 20, 2024, 19:57 UTC
Message-ID
<86226be8-7a1d-454a-b3dc-7d5921b47329@mfriebe.de>
In-Reply-To
<xmqqzfvvovva.fsf@gitster.g>
On 20/02/2024 19:04, Junio C Hamano wrote:
Show 5 quoted lines
> [References]
> 
> *1* https://lore.kernel.org/git/211021.86wnm6l1ip.gmgdl@evledraar.gmail.com/
> *2* https://lore.kernel.org/git/xmqqzg6eocmi.fsf@gitster.g/
> 
 From 2
> I think the "switch" was written exactly for such a transition so that folks who
> wanted a different behaviour do not have to break existing users of "checkout".

Yet then the table in link 1 suggests to re-use -c and -m in the old style, the way the currently are used in "git branch"

"Introducing a new behaviour" is exactly not having to copy old meanings of options...

As I wrote
> The flaw here is in "git branch" which by default list branches, but if give a name (and no option to specify an action) "git branch foo" will change its action to "create". 

If "git branche" actually had needed an option to change its action to create, what would it have been? --create or -c ?

And -n (as suggested in the table) is strongly associated with dry-run. (not only in git)

If I look at the suggestion to replace -m by --merge, just so that -m 
can be "move", then I seriously ask, what happens more often:
- Someone switching to a branch while having modifications in their 
worktree (needing to merge)
- Someone creating a new branch, wanting to copy reflog/options

Given not only that switching to a new branch happens more often than creating one (and thereby makes it alt least plausible, that the -m as "merge" is required more often)..., but also that "git switch" is more about switching than creating branches..., I believe that -m as "merge" is entirely the better choice.

For the "git branch" features, if "git switch" should support them, they could easily be made available as --cc create and copy --mv move

They - by all likelihood - are used less often, and should be the long options. And a 2 letter long option is still easy to use.

Previous: Matthieu BaertsNext: Martin
Message 7 of 9 in “Revert "Declare both git-switch and git-restore experimental"”
  1. Revert "Declare both git-switch and git-restore experimental"Matthieu Baerts (NGI0), Feb 20, 2024
  2. Kristoffer HaugsbakkFeb 20, 2024
  3. Matthieu BaertsFeb 20, 2024
  4. Kristoffer HaugsbakkFeb 20, 2024
  5. Junio C HamanoFeb 20, 2024
  6. Matthieu BaertsFeb 20, 2024
  7. MartinFeb 20, 2024
  8. MartinFeb 20, 2024
  9. Kristoffer HaugsbakkFeb 20, 2024

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.