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

Re: [RFC/PATCH] worktree: replace "checkout --to" with "worktree new"

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 30, 2015, 16:33 UTC
Message-ID
<xmqqy4j16tqk.fsf@gitster.dls.corp.google.com>
In-Reply-To
<CACsJy8BYeYq-fQX=M1h2r4daQSsemXQT4Y+ww2Z3Y54brUS3QQ@mail.gmail.com>
Duy Nguyen <pclouds@gmail.com> writes:
Show 6 quoted lines
> I think this is like "git checkout -b" vs "git branch". We pack so
> many things in 'checkout' that it's a source of both convenience and
> confusion. I never use "git branch" to create a new branch and if I
> had a way to tell checkout to "move away and delete previous branch",
> I would probably stop using "git branch -d/-D" too. "--to" is another
> "-b" in this sense.

I didn't know "checkout --to" included "create a worktree elsewhere and chdir there"; if that "and chdir there" is not something you are doing, then I do not think "checkout -b" vs "branch" analogy applies.

> "git worktree new" definitely makes sense (maybe stick with verbs like
> "create", I'm not sure if we have some convention in existing
> commands), but should we remove "git checkout --to"?
I'm in favor of removing "--to" before it escapes the lab.

I am ambivalent about "new", but that is only because I know about the 'new-workdir' in contrib/. If I pretend to be a naive end user, I'd think a verb subcommand would be more in line with the rest of the system than "new".

I however do not think "create" is a good verb.

Wouldn't "git worktree $the-command-in-question" be a management command that adds a new worktree to the existing collection, like "remote add", "notes add", etc. do? Perhaps "git worktree list" and "git worktree remove $that_one" would be in its future?

That suggests "add" may be a better choice for "worktree".

The only subcommand that I can think of offhand that says "create" is "bundle"; after generates a new bundle, its presence is not known to the repository the bundle was created out of, so not using "add" but calling the operation "create" is fine for "bundle".

Previous: Duy NguyenNext: Duy Nguyen
Message 3 of 27 in “worktree: replace "checkout --to" with "worktree new"”
  1. worktree: replace "checkout --to" with "worktree new"Eric Sunshine, Jun 30, 2015
  2. Duy NguyenJun 30, 2015
  3. Junio C HamanoJun 30, 2015
  4. Duy NguyenJul 1, 2015
  5. Eric SunshineJun 30, 2015
  6. Eric SunshineJul 1, 2015
  7. Junio C HamanoJun 30, 2015
  8. Eric SunshineJun 30, 2015
  9. Junio C HamanoJun 30, 2015
  10. Mikael MagnussonJul 1, 2015
  11. Mark LevedahlJun 30, 2015
  12. Junio C HamanoJul 1, 2015
  13. Eric SunshineJul 1, 2015
  14. Eric SunshineJul 1, 2015
  15. Junio C HamanoJul 1, 2015
  16. Eric SunshineJul 1, 2015
  17. Junio C HamanoJul 1, 2015
  18. Duy NguyenJul 2, 2015
  19. Eric SunshineJul 2, 2015
  20. Duy NguyenJul 2, 2015
  21. Duy NguyenJul 2, 2015
  22. Eric SunshineJul 2, 2015
  23. Duy NguyenJul 2, 2015
  24. Eric SunshineJul 2, 2015
  25. Eric SunshineJul 2, 2015
  26. Eric SunshineJul 2, 2015
  27. Eric SunshineJul 2, 2015

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.