Skip to main content

Overview

GWTree supports global flags that modify command behavior. Flags can be used with specific commands to override configuration settings or change execution flow.

Global Flags

Help and Version

These flags work with any command:
flag
Display help information for the command.
flag
Output the current version number.

Create Command Flags

These flags modify the behavior of the default create command:

-y, —yes

flag
Use saved defaults and skip all interactive prompts.Skips prompts for:
  • Uncommitted changes handling
  • Branch switching
  • Pull from remote
  • Worktree/branch naming (requires name argument)
Still uses:
  • Configured editor
  • Configured dependency installation
  • Detected package manager
Usage:
Behavior with -y: Example output:
Notice: No interactive prompts!

-x, —no-editor

flag
Skip opening the editor after worktree creation.Overrides the editor configuration setting for this command only.
Usage:
Use cases:
  • Scripts: Automated worktree creation
  • CI/CD: Non-interactive environments
  • Batch operations: Create multiple worktrees without opening many editor windows
  • Manual navigation: Open editor yourself later
Example:

Clean Command Flags

-a, —all

flag
Remove all worktrees, not just merged ones.
This removes ALL worktrees including:
  • Worktrees with uncommitted changes
  • Worktrees with unmerged commits
  • Active development branches
Use with caution!
Usage:
Comparison:
Output:
Without -a (default):
Removes only feature-merged. With -a:
Removes both feature-merged AND feature-active (losing uncommitted work!).

Flag Combinations

Flags can be combined in various ways:

Create with Multiple Flags

Aliases with Flags

Flag Syntax

GWTree supports both short and long flag formats: Examples:

Flag Positioning

Flags can appear before or after arguments:
For multiple names:

Examples by Use Case

Fast Development

Quick worktree creation with zero interaction:

Scripting

Automated worktree creation:

Manual Control

Create but handle editor yourself:

Cleanup

Aggressive cleanup of all worktrees:

Help

Get help for specific commands:
The GWTree banner is automatically hidden when:
  • Using -v or --version flag
  • Using -h or --help flag
  • Using -y flag with a name argument (fast mode)
  • Running gwt version command
  • Running gwt help command
Banner shown:
Banner hidden:

Configuration vs. Flags

Flags override configuration settings: Config file:
With flag:
Precedence:
  1. Command-line flags (highest)
  2. Configuration file
  3. Defaults (lowest)