PostHog Desktop worktrees

Contents

Worktrees give agents a local, isolated checkout inside PostHog Desktop. Use them when you want an agent to work on a separate branch without touching your current working directory.

Getting started

To create a worktree:

  1. Open the mode selector.
  2. Choose Worktree.
  3. Enter your prompt.
  4. Submit the task.
Task mode selector

For simple development environments, this is typically all you'll need.

Environment setup

For more complex projects, you may need extra configuration. PostHog Desktop supports two files for this:

FileUse it to
.worktreeincludeCopy required ignored files into each worktree
.worktreelinkSymlink required ignored files or directories into each worktree

For setup scripts that run when a worktree is created (installing dependencies, running migrations, and so on), see Local environments.

.worktreeinclude

Worktrees create fresh checkouts of your git repo, so they do not include untracked files like .env.

To automatically copy required files, add them to a .worktreeinclude file at the root of your project.

Example:

Terminal
# .worktreeinclude
.env
.env.local

This file uses .gitignore syntax. Only matching files that are also ignored by git are copied.

Some files may be required for your environment but are too heavy to copy, such as a .flox directory.

Add these files or directories to .worktreelink. PostHog Desktop creates symlinks for them when a new worktree is created.

Example:

Terminal
# .worktreelink
.flox

This file also uses .gitignore syntax. It only creates links to files that are ignored by git.

Still have questions?

Was this page useful?