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

Re: [PATCH] builtin/worktree.c: add option for setting worktree name

From
Barret Rennie <barret@brennie.ca>
Date
Jun 25, 2016, 07:29 UTC
Message-ID
<6FF436EC-65BE-472A-A347-1E0DCD7526AF@brennie.ca>
In-Reply-To
<576E2FA9.7070008@kdbg.org>
> What is "the name for the worktree"? Is it the directory where it lives in?
>Is it how it is listed with 'git worktree list'?

The name of the worktree is the name of the created directory in `.git/worktrees`.

> How is --name different from the <path> argument?
Currently, if you run:
	
	git worktree add /my/worktree/checkout <branch>

you get a worktree "named" checkout, i.e., `.git/worktrees/checkout`. The idea with this patch is to allow you use a more specific name when you would otherwise have mulitiple worktrees of the form `checkout`, `checkout1`, etc.

That is, you could do
	git worktree add --name branch1 /worktrees/branch1/src branch1
	git worktree add --name branch2 /worktrees/branch2/src branch2
	git worktree add --name branch3 /worktrees/branch3/src branch3

and have `.git/worktrees/branch1`, `.git/worktrees/branch2` and `.git/worktrees/branch3` instead of `.git/worktrees/src`, `.git/worktrees/src1`, `.git/worktrees/src2`. That way, it becomes more clear when poking inside `.git/worktrees` which directory points to which checkout.

Perhaps "worktree name" isn't the most clear nomenclature for this feature. Would "worktree directory name" be better?

Previous: Johannes SixtNext: Barret Rennie
Message 5 of 16 in “builtin/worktree.c: add option for setting worktree name”
  1. builtin/worktree.c: add option for setting worktree nameBarret Rennie, Jun 25, 2016
  2. Junio C HamanoJun 25, 2016
  3. Barret RennieJun 25, 2016
  4. Johannes SixtJun 25, 2016
  5. Barret RennieJun 25, 2016
  6. Barret RennieJun 25, 2016
  7. Junio C HamanoJun 25, 2016
  8. Barret RennieJun 25, 2016
  9. Junio C HamanoJun 26, 2016
  10. Barret RennieJun 27, 2016
  11. Junio C HamanoJun 27, 2016
  12. Eric SunshineJun 26, 2016
  13. Barret RennieJun 27, 2016
  14. Eric SunshineJun 27, 2016
  15. Barret RennieJun 29, 2016
  16. Barret RennieJun 25, 2016

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.