New Environment

What to fill in when creating an environment, which worktrees and branches Kovra creates, and how failures are handled.

Creating an environment sets up worktrees for a group of repositories you want to modify and run together. Press Ctrl+N or select New Environment in the Command Palette.

Dialog fields

Field Description
Environment name A name for the environment, such as login-redesign.
Repositories to modify Check the repositories you plan to edit in this environment. Unchecked repositories borrow from the main environment. Single-instance repositories cannot be checked.
Base branch The branch to create each checked repository’s new branch from. Defaults to the main branch; Kovra remembers your last choice.

Default directory and branch names

  • Worktree directory: Created alongside the repository as <repo>_<env>.
  • New branch: Defaults to feature/<env>.

Both templates can be customized in project settings. You can also override an individual repository’s directory or branch name directly in the dialog for a one-off change.

Creation process

For each checked repository, Kovra runs git worktree add -b to create the worktree and new branch.

It also copies gitignored local configuration files into the new worktree. By default, this includes:

  • .env, .env.*
  • application-local.*
  • config.local.*
  • local.settings.json

If any step fails, Kovra rolls back cleanly so no partial state is left behind.

Missing local files in an existing environment

If an existing environment is missing any of these local configuration files, you can sync them from the main directory in one click from the UI.

How existing worktrees are grouped

Worktrees created outside Kovra are automatically grouped into environments using four rules, evaluated in order:

  1. Exact same branch name;
  2. Same ticket or numeric ID in the branch name (for example, both containing 682);
  3. Same suffix on the worktree directory name (for example, web_682 and api_682);
  4. Otherwise, each worktree becomes its own environment.

Detached worktrees are grouped by directory name. In single-repository projects, each worktree is its own environment.

Edit this page on GitHub ↗