Skip to main content
GWTree stores configuration in a JSON file that controls automatic behaviors when creating worktrees.

Configuration File

GWTree uses a global configuration file stored at:

Open Configuration

Open the config file in your editor:
This opens the file in your configured editor.

View Configuration Path

If you have editor set to none:

Reset Configuration

Reset all settings to defaults:
Output:

Configuration Schema

The config file contains three main settings:

editor

Controls which editor opens after creating a worktree. Type: string
Options: "code", "cursor", "default", "none"
Default: "code"

Options

Opens worktrees in Visual Studio Code.
Runs:
Requirements:
  • VS Code installed
  • code command in PATH
Behavior:
  • Opens each worktree in a new window
  • Batch creation opens multiple windows

Skip Editor with Flag

Temporarily skip editor opening without changing config:

installDeps

Controls whether dependencies are automatically installed after creating a worktree. Type: boolean
Default: true

Enable Dependency Installation

When enabled:
  • Detects package manager from lockfiles
  • Runs install command automatically
  • Uses lastPm as fallback if no lockfile found

Disable Dependency Installation

When disabled:
  • Skips installation step entirely
  • Faster worktree creation
  • Manual installation required

Package Manager Detection

GWTree detects the package manager in this order:
  1. pnpm: If pnpm-lock.yaml exists
  2. bun: If bun.lockb exists
  3. yarn: If yarn.lock exists
  4. npm: If package-lock.json exists
  5. pnpm (default): If only package.json exists
  6. lastPm: If no lockfiles found

Install Commands

lastPm

Tracks the last package manager used successfully. Type: string | null
Options: "pnpm", "npm", "yarn", "bun", null
Default: null

Automatic Updates

This field is automatically updated by GWTree:
When a worktree is created:
  1. GWTree detects the package manager
  2. Runs the install command
  3. Updates lastPm to the detected package manager

Fallback Behavior

When no lockfile is found:
  • If lastPm is set: Uses that package manager
  • If lastPm is null: No installation occurs
This allows GWTree to remember your preference across worktrees.

Manual Configuration

You can manually set a preferred package manager:
This ensures bun is used when no lockfile is detected.

Configuration Examples

VS Code + Always Install

Behavior:
  • Opens worktrees in VS Code
  • Installs dependencies automatically
  • Prefers pnpm when no lockfile

Cursor + Skip Install

Behavior:
  • Opens worktrees in Cursor
  • Skips dependency installation
  • No package manager fallback

Terminal Vim + NPM

Behavior:
  • Opens worktrees in $EDITOR (vim)
  • Installs dependencies with npm
  • Uses npm when no lockfile

No Editor + Manual Install

Behavior:
  • No automatic editor opening
  • No automatic dependency installation
  • Maximum control, minimum automation

Fast Mode (CI/Scripting)

Behavior:
  • No editor opening
  • No dependency installation
  • Fast worktree creation for scripts

Configuration Workflow

Initial Setup

Common Adjustments

Switch to Cursor

Disable Auto-install for Speed

Prefer Bun

Advanced Configuration

Per-Command Overrides

Config settings can be overridden per command:

Team Configuration

For teams, you can share config via documentation:
Each developer runs:

Environment-Specific Config

Development Machine

Remote SSH Session

CI/CD Pipeline

Troubleshooting

Editor Not Opening

Problem: Editor configured but doesn’t open Solutions:
  1. Verify editor is installed
  2. Check editor command is in PATH:
  3. Try running command manually:
  4. Check config file:

Dependencies Not Installing

Problem: installDeps is true but nothing installs Solutions:
  1. Check installDeps setting:
  2. Verify lockfile exists in repo
  3. Set lastPm to preferred package manager
  4. Check package manager is installed:

Wrong Package Manager

Problem: Using npm but want pnpm Solutions:
  1. Delete lockfiles from other package managers
  2. Set lastPm to preferred:
  3. Ensure lockfile exists:

Config Changes Not Applied

Problem: Edited config but behavior unchanged Solutions:
  1. Verify JSON syntax is valid
  2. Check no trailing commas
  3. Restart terminal/shell
  4. View config path:
  5. Reset and reconfigure:

Next Steps