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

Re: [PATCH v2 0/4] worktree: add lifecycle hooks

From
Domen Kožar <domen@cachix.org>
Date
Sep 7, 2026, 19:34 UTC
Message-ID
<8fda00ab-a7ac-4ccb-95bb-9d2e28163bb7@mtasv.net>
In-Reply-To
<de83b791-92ae-41a1-8ecf-5abce7893998@app.fastmail.com>
Hi Kristoffer,

Thanks for the suggestion. An ownership ID could help tools avoid interfering with each other's worktrees.

The case I'm trying to support has two separate participants: an IDE or agent creates and removes worktrees, while devenv provisions and cleans up the development environment associated with each one.

devenv doesn't own those worktrees or control the commands that create them. It needs to observe their lifecycle regardless of which tool invokes Git. Even if the creator supplies an ownership ID, how would devenv learn that a worktree was added or removed?

Requiring the creator to explicitly notify devenv would bring back the per-tool integration requirement that motivates the hook. The same applies to worktrees created or removed directly by the user.

Pruning is another useful case: Git knows which administrative entries it actually removes, including entries whose directories are already gone. A hook could report each removal directly to interested tooling.

Would ownership IDs and lifecycle notifications serve complementary purposes here?

Thanks, Domen

Previous: Kristoffer HaugsbakkNext: Maciej Ciemborowicz
Message 9 of 21 in “worktree: add post-worktree-add and post-worktree-remove hooks”
  1. 0/3 worktree: add post-worktree-add and post-worktree-remove hooksDomen Kožar, Jul 9, 2026
  2. Phillip WoodJul 10, 2026
  3. 0/4 worktree: add lifecycle hooksDomen Kožar, Aug 4, 2026
  4. Caleb WhiteAug 4, 2026
  5. Junio C HamanoAug 4, 2026
  6. Domen KožarAug 30, 2026
  7. Domen KožarSep 7, 2026
  8. Kristoffer HaugsbakkSep 7, 2026
  9. Domen KožarSep 7, 2026
  10. Maciej CiemborowiczOct 3, 2026
  11. 0/2 worktree: add post-worktree lifecycle hookDomen Kožar, Oct 4, 2026
  12. Junio C HamanoOct 5, 2026
  13. Phillip WoodJul 13, 2026
  14. 1/4 worktree: add post-worktree-add hookDomen Kožar, Aug 4, 2026
  15. Caleb WhiteAug 4, 2026
  16. 4/4 worktree: add post-worktree-move hookDomen Kožar, Aug 4, 2026
  17. 2/4 worktree: add post-worktree-remove hookDomen Kožar, Aug 4, 2026
  18. 3/4 worktree: run post-worktree-remove hook when pruningDomen Kožar, Aug 4, 2026
  19. 1/2 worktree: add post-worktree lifecycle hookDomen Kožar, Oct 4, 2026
  20. Phillip WoodOct 6, 2026
  21. 2/2 worktree: notify post-worktree hook when pruningDomen Kožar, Oct 4, 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.