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:Display help information for the command.
Output the current version number.
Create Command Flags
These flags modify the behavior of the default create command:-y, —yes
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)
- Configured editor
- Configured dependency installation
- Detected package manager
| Prompt | Without -y | With -y |
|---|---|---|
| Uncommitted changes | Asks to stash | Auto-stashes |
| Not on main | Asks to switch | Auto-switches |
| Pull from remote | Asks to pull | Auto-pulls |
| Worktree name | Prompts | Uses argument |
-x, —no-editor
Skip opening the editor after worktree creation.Overrides the
editor configuration setting for this command only.- 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
Clean Command Flags
-a, —all
Remove all worktrees, not just merged ones.
feature-merged.
With -a:
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:| Short | Long | Command |
|---|---|---|
-y | --yes | create |
-x | --no-editor | create |
-a | --all | clean |
-h | --help | all |
-v | --version | all |
Flag Positioning
Flags can appear before or after arguments: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:Banner Suppression
The GWTree banner is automatically hidden when:- Using
-vor--versionflag - Using
-hor--helpflag - Using
-yflag with a name argument (fast mode) - Running
gwt versioncommand - Running
gwt helpcommand
Configuration vs. Flags
Flags override configuration settings: Config file:- Command-line flags (highest)
- Configuration file
- Defaults (lowest)
Related Documentation
- gwt (create) - Create command that uses -y and -x flags
- gwt clean - Clean command that uses -a flag
- gwt config - Configure default behavior