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

Re: [PATCH] worktree: clarify --expire applies to missing worktrees

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 20, 2025, 07:31 UTC
Message-ID
<xmqqfr95txrz.fsf@gitster.g>
In-Reply-To
<CAPig+cTsKgzLvz_BJxTLqRfc5A7CK_FNo_L6TDOGPVGG9eXDCw@mail.gmail.com>
Eric Sunshine <sunshine@sunshineco.com> writes:
Show 15 quoted lines
> On Sat, Dec 20, 2025 at 12:44 AM Junio C Hamano <gitster@pobox.com> wrote:
>> I wonder if this would work better.
>>
>>         `prune`::
>>                 Remove worktree information in `$GIT_DIR/worktrees`
>>                 only, without touching the working tree.  This is
>>                 often needed when the working tree is lost (e.g.,
>>                 the user manually removed it) and the worktree
>>                 information has become dangling.
>
> Yes, this is a useful improvement, although one part confuses me (and
> I would omit it). In particular, if the working tree is lost, thus the
> `$GIT_DIR/worktrees` is dangling ought to be removed, then I'm not
> sure why you would say "without touching the working tree" (which is
> already lost).

Ahh, I somehow thought you can say "git worktree prune <worktree>" to remove only the control information while the working tree is still there, sort of "orphaning" the working tree from the main repository. But things do not work that way.

You're right that "without touching the working tree" part is misleading and redundant. And it is not "this is often needed"; it is the _only_ scenario the operation makes sense.

	`prune`::
		Remove worktree information in `$GIT_DIR/worktrees`
		for worktrees whose working trees are missing.
		Useful after manually removing a working tree that
		is no longer needed (but use "git worktree remove"
		next time you want to do so).  Also if you _moved_ a
		working tree elsewhere to cause the worktree
		information dangling, see "git worktree repair" to
		reconnect the worktree to the new working tree
		location.
perhaps?
Previous: Eric SunshineNext: Eric Sunshine
Message 5 of 14 in “worktree: clarify --expire applies to missing worktrees”
  1. worktree: clarify --expire applies to missing worktreesSam Bostock via GitGitGadget, Dec 19, 2025
  2. Eric SunshineDec 19, 2025
  3. Junio C HamanoDec 20, 2025
  4. Eric SunshineDec 20, 2025
  5. Junio C HamanoDec 20, 2025
  6. Eric SunshineDec 20, 2025
  7. 0/2 worktree: clarify --expire applies to missing worktreesSam Bostock via GitGitGadget, Dec 19, 2025
  8. 1/2 worktree: clarify --expire applies to missing worktreesSam Bostock via GitGitGadget, Dec 19, 2025
  9. Junio C HamanoDec 20, 2025
  10. 2/2 worktree: use 'prune' instead of 'expire' in help textSam Bostock via GitGitGadget, Dec 19, 2025
  11. Junio C HamanoDec 20, 2025
  12. Junio C HamanoJan 21, 2026
  13. worktree: clarify that --expire only affects missing worktreesSam Bostock via GitGitGadget, Jan 28, 2026
  14. Eric SunshineJan 30, 2026

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.