Skip to main content

Syntax

Description

Manages GWTree’s configuration file. With no arguments, opens the config file in your configured editor. Use reset action to restore default settings.

Arguments

string
Action to perform. Supported values:
  • Omit to open config file in editor
  • reset - Reset configuration to defaults

Configuration File

GWTree stores configuration in a JSON file managed by the conf package. Location:
  • macOS: ~/Library/Preferences/gwtree-nodejs/config.json
  • Linux: ~/.config/gwtree-nodejs/config.json
  • Windows: %APPDATA%\gwtree-nodejs\Config\config.json

Configuration Options

editor

string
default:"code"
Which editor to open after creating a worktree.Options:
  • code - Visual Studio Code
  • cursor - Cursor editor
  • default - Use $EDITOR environment variable
  • none - Don’t open any editor

installDeps

boolean
default:true
Whether to automatically install dependencies when creating worktrees.When true, runs the appropriate package manager install command:
  • pnpm install
  • npm install
  • yarn install
  • bun install

lastPm

string
default:null
Last detected package manager. Auto-updated by GWTree.Options:
  • pnpm
  • npm
  • yarn
  • bun
  • null - Not yet detected
This is automatically set when creating worktrees based on lock files detected.

Examples

Open config file

Opens the config file in your configured editor (defaults to VS Code).

Reset to defaults

Output:

Get config location

If editor is set to none:
Output:

Config File Structure

Default config:
Customized config:

Editing Configuration

Using gwt config

This opens the file in your editor. Make changes and save.

Manual editing

Example edits

Disable dependency installation:
Use Cursor editor:
Use system default editor:
Disable editor opening:

Editor Behavior

Visual Studio Code (code)

Opens worktree in new VS Code window.

Cursor (cursor)

Opens worktree in Cursor editor.

Default (default)

Uses $EDITOR environment variable:
Common values:
  • vim
  • nvim
  • emacs
  • nano
Set in your shell config:

None (none)

Skips opening any editor. Useful for:
  • CI/CD environments
  • Scripts
  • Terminal-only workflows

Dependency Installation

When installDeps is true, GWTree:
  1. Detects package manager from lock files:
    • pnpm-lock.yamlpnpm
    • bun.lockbbun
    • yarn.lockyarn
    • package-lock.jsonnpm
    • Only package.jsonpnpm (default)
  2. Runs install command:
  3. Updates lastPm config for next time

Disable for faster creation

Then manually install:

Worktrees Registry

GWTree also maintains a separate registry of worktrees: Location: ~/.gwtree/worktrees.json This file tracks all worktrees created by GWTree across all repositories. It’s managed automatically and shouldn’t need manual editing. Structure:

Resetting Configuration

Reset all settings

Restores:
  • editor: code
  • installDeps: true
  • lastPm: null

Selective reset

Edit config and remove specific keys. They’ll use defaults on next run.

Environment Variables

EDITOR

Used when editor is set to default:
If $EDITOR is not set, falls back to vim.

Common Configurations

For VS Code users (default)

For Cursor users

For terminal-only workflows

For scripts/CI

Combine with -y flag:

Troubleshooting

Config file not opening

Issue: gwt config doesn’t open editor Solutions:
  1. Check editor is installed:
  2. Try different editor:
  3. Get path and open manually:

Dependencies not installing

Issue: Dependencies aren’t installed automatically Check config:
Check package manager:

Wrong package manager

Issue: Using npm but want pnpm Solution: Create appropriate lock file in main repo:
Next worktree will use pnpm.

Exit Codes

  • 0 - Success (config opened or reset)
  • No error codes - Config command always succeeds
  • gwt (create) - Uses config settings when creating worktrees
  • Flags - Override config with command-line flags