pub enum Command {
Show 37 variants
Init {
preset: Option<String>,
list_presets: bool,
show: bool,
},
List {
format: ListFormat,
detect_pr: bool,
},
Create {
branch_type: String,
issue: String,
desc: String,
no_bootstrap: bool,
reuse_branch: bool,
skip_hooks: Option<String>,
repo: Option<String>,
},
Pr {
render: bool,
draft: bool,
base: Option<String>,
},
Review {
number: u64,
name: Option<String>,
bootstrap: bool,
skip_hooks: Option<String>,
},
New {
branch_type: String,
desc: String,
no_bootstrap: bool,
reuse_branch: bool,
skip_hooks: Option<String>,
},
Remove {
pattern: String,
delete_branch: bool,
dry_run: bool,
force: bool,
skip_hooks: Option<String>,
},
Path {
pattern: String,
format: OutputFormat,
},
Bootstrap {
target: Option<String>,
skip_hooks: Option<String>,
},
Sync {
pattern: Option<String>,
merge: bool,
},
Prune {
dry_run: bool,
},
Doctor {
format: OutputFormat,
},
Daemon {
socket: Option<PathBuf>,
poll_ms: u64,
},
Statusline {
socket: Option<PathBuf>,
watch: bool,
},
Types {
gitmoji: bool,
},
CommitPrefix {
branch: Option<String>,
unicode: bool,
},
Hooks {
action: HooksAction,
},
Completions {
shell: Shell,
},
ShellInit {
shell: InitShell,
},
Switch,
Tmux {
pattern: String,
split: bool,
},
Zellij {
pattern: String,
split: bool,
},
Link {
target: LinkTarget,
number: u64,
worktree: Option<String>,
},
Unlink {
target: LinkTarget,
worktree: Option<String>,
},
Open {
target: LinkTarget,
worktree: Option<String>,
print_url: bool,
},
Status {
worktree: Option<String>,
json: bool,
},
Labels {
action: LabelsAction,
},
Milestones {
action: MilestonesAction,
},
Trust {
action: TrustAction,
},
Aliases {
action: AliasesAction,
},
Config {
action: ConfigAction,
},
History {
limit: usize,
all: bool,
},
Undo {
bootstrap: bool,
},
Tui {
action: TuiAction,
},
Theme {
action: ThemeAction,
},
Exec {
slugs: Vec<String>,
profile: Option<String>,
jobs: Option<u32>,
command: Vec<String>,
},
Clean {
slugs: Vec<String>,
profile: Option<String>,
yes: bool,
},
}Variants§
Init
Write a .gwm.toml to the current repo, optionally from a stack preset.
Fields
preset: Option<String>Seed an opinionated .gwm.toml for a known stack (e.g. laravel,
node/nuxt, rust, go, python-uv). Omit for the generic
documented template. Run gwm init --list-presets to see them all.
List
List worktrees in the current repo.
Fields
format: ListFormatOutput format. names prints one worktree name per line (for shell completion).
Create
Create a new worktree (and matching branch).
Fields
reuse_branch: boolAttach the new worktree to an already-existing local branch of the
same name instead of refusing (issue #99). Off by default — a
pre-existing branch ends gwm create with an error naming the
stale tip so the user can audit it.
Pr
Render the PR body from [pr_template] (issue #84), then
gh pr create unless --render is passed.
Without --render, the rendered Markdown is written to a temp
file and shelled out to gh pr create --title <subject> --body-file <tmp> --head <branch> (plus --draft and --base when
specified). The body resolution honours
[pr_template.by_type.<type>] (inline body wins over per-type
path), then [pr_template].default as a fallback.
Placeholders substituted by the template engine:
{type} {issue} {desc} {base} {head} {repo}
{commits} — git log --pretty='- %s' base..head
{files_changed} — git diff --stat base..head, capped 30 lines
Fields
render: boolRender the body to stdout instead of creating the PR. The output
is suitable for piping into gh pr create --body-file -.
Review
Materialise an existing GitHub PR into an isolated worktree (issue #308).
Resolves the PR head via gh and fetches origin’s universal
refs/pull/<N>/head ref — cross-fork aware, and valid for PRs in any
state (open / draft / closed / merged) — into a local
review/pr-<N>-<author>-<slug> branch, attaches a worktree, and links
the PR so the sidebar / CI indicator light up immediately. Tear down
with gwm remove <dir> --delete-branch like any worktree.
Safe-by-default: bootstrap and lifecycle hooks are NOT run, because a
review worktree holds a contributor’s (possibly fork) code and those
steps execute commands against it (npm install, composer install,
direnv allow, post_create hooks …) — i.e. arbitrary code. Pass
--bootstrap to opt in once you trust the PR enough to set it up.
Fields
name: Option<String>Override the local review branch name (defaults to
review/pr-<N>-<author>-<slug>). The worktree directory is derived
from this name (slashes become dashes).
New
Create a GitHub issue from templates, then create its worktree.
Fields
Remove
Remove a worktree by fuzzy name match.
Fields
dry_run: boolPrint the resolved worktree (name + path + branch + would-delete-branch
flag) without touching anything. Exit code 0. If the pattern is
ambiguous, the same non-zero candidate-list error fires as in the
destructive form — --dry-run only suppresses destruction, not
resolution failures. Issue #31.
Path
Print the on-disk path of a worktree (use $(gwm path …) to cd into it).
Also available as gwm cd <pattern> — same semantics, framed for the
cd flow. Pair with gwm shell-init <shell> for a one-line wrapper.
Fields
format: OutputFormatOutput format. json emits { name, path, branch } (issue #38);
the default text prints the bare path for shell consumption.
Bootstrap
Re-run bootstrap on an existing worktree.
Fields
Sync
Fetch + rebase (or merge) a worktree’s branch onto its upstream.
Resolves the target worktree (defaults to the CWD worktree when
no pattern is given), runs git fetch for its upstream’s remote,
then rebases the branch onto the upstream — or merges with
--merge. Reports the outcome with the same ✓ / ! / ✗ sigils as
the rest of gwm.
Refuses up front on a dirty working tree (commit or stash first) and on a branch with no upstream configured. A conflicting rebase/merge is aborted so the worktree stays usable, and the user is told to reconcile by hand. Issue #24.
Fields
Prune
Prune stale worktree references (admin files without a working dir).
Fields
Doctor
Diagnose the gwm setup (config, env, worktree state).
Exit code 0 if all green, 1 if any warning, 2 if any failure — suitable for CI / pre-commit hooks.
Fields
format: OutputFormatOutput format. json emits the checks array plus aggregate
severity / exit_code (issue #38); the default text prints
the sigil-prefixed report. The process exit code is identical
either way.
Daemon
Run a long-running JSON-RPC 2.0 daemon over a unix domain socket.
Editors, statusbars, and tooling connect once and call list /
doctor / path, or subscribe for pushed worktrees.changed
notifications — instead of spawning gwm per query (issue #38).
Newline-delimited JSON, one request and one response per line.
Unix-only and built behind the default-on daemon feature; on other
platforms / --no-default-features builds the command exits with an
explanatory error.
Fields
socket: Option<PathBuf>Socket path to bind. Defaults to $XDG_RUNTIME_DIR/gwm.sock,
falling back to $TMPDIR, then /tmp.
poll_ms: u64Worktree-state poll interval in milliseconds for subscribe push
notifications. Lower = faster updates, more git scans. This MVP
polls rather than watching the filesystem (no notify dep).
Must be ≥ 1: 0 would spin a subscribe loop with no wait,
re-scanning git as fast as the CPU allows (issue #38 review).
Statusline
Print a compact one-line worktree summary for shell prompts (issue #309).
The first real consumer of gwm daemon: it connects to the daemon’s
unix socket, asks for the worktree set, and renders a single line —
active branch, worktree count, dirty / ahead / behind, linked issue /
PR — suitable for a tmux / starship / zsh statusline. With --watch
it subscribes to the daemon’s worktrees.changed stream and reprints
on every change (one line per update).
Needs a running gwm daemon (one per repo). When none is reachable it
prints an empty line and exits 0, so a prompt substitution degrades to
nothing instead of erroring. A CI rollup is intentionally not shown —
it is not part of the daemon’s stable schema.
Fields
Types
List the supported branch types.
Pass --gitmoji to extend the output with two more columns: the
resolved emoji (unicode) and its :shortcode: form (issue #85).
The shortcode mapping is the built-in default plus any per-repo
overrides under [gitmoji] in .gwm.toml.
Fields
CommitPrefix
Print the Gitmoji + Conventional Commits prefix for the current (or named) branch (issue #85).
Output shape: :sparkles: feat(#41): — the canonical commit
prefix used across this repo (see CONTRIBUTING.md §Commits).
--unicode substitutes the shortcode for the real emoji
character (e.g. ✨ instead of :sparkles:); useful for shell
prompts and the bundled commit-msg hook.
Without --branch, reads the current branch from HEAD via
libgit2 — requires the CWD to be inside a git repo.
Fields
Hooks
Manage git hooks installed by gwm (issue #85).
Currently exposes a single hook: commit-msg, which
auto-prepends the resolved Gitmoji + Conventional Commits
prefix when the commit message doesn’t already start with one.
Hooks are opt-in — gwm never installs them implicitly.
Fields
action: HooksActionCompletions
Generate a shell completion script on stdout.
Install (zsh): gwm completions zsh > $fpath[1]/_gwm
Install (bash): gwm completions bash > /etc/bash_completion.d/gwm
Install (fish): gwm completions fish > ~/.config/fish/completions/gwm.fish
ShellInit
Print a shell wrapper exposing gcd <pattern> (one-line cd into a worktree).
Install (zsh): echo 'eval "$(gwm shell-init zsh)"' >> ~/.zshrc
Install (bash): echo 'eval "$(gwm shell-init bash)"' >> ~/.bashrc
Install (fish): gwm shell-init fish | source (also add to config.fish)
Install (powershell): Invoke-Expression (& gwm shell-init powershell | Out-String)
Switch
Open an interactive picker; print the chosen worktree’s path on stdout.
Same TUI as gwm itself, minus the create / delete / bootstrap actions.
The fuzzy filter bar opens immediately so typing narrows the list right
away. Press Enter to commit the highlighted pick; Esc / Ctrl-C / q
quits without printing anything (exit code 1).
Typically invoked via gcd (no arg) from the bundled gwm shell-init
wrapper, which cd’s into the picked worktree in one keystroke. The raw
form is cd "$(gwm switch)" (or gwm s, the alias).
Tmux
Open the matched worktree in a new tmux window (current session).
Requires $TMUX to be set — i.e. gwm must be invoked from inside an
existing tmux session. Outside a tmux session the command exits
non-zero with a clear error rather than spawning a stray server.
Use --split to open in a horizontal split of the current pane
instead of a new window.
Fields
Zellij
Open the matched worktree in a new zellij tab (current session).
Requires $ZELLIJ to be set. --cwd on zellij action new-tab
needs zellij ≥ 0.40. Use --split to open in a new pane of the
current tab instead of a new tab.
Fields
Link
Link the current (or named) worktree to a GitHub issue or pull request.
The link is stored in git config branch.<name>.gwm-issue (or
gwm-pr) — local, per-branch, survives worktree moves. Issue
numbers are auto-detected from the <type>/#<N>-<slug> convention
when no explicit override is set; gwm link issue <N> overrides
that. PR numbers are not auto-detected; link them explicitly with
gwm link pr <N>.
Fields
target: LinkTargetWhat to link: issue or pr.
Unlink
Remove the explicit issue / PR link on the current (or named) worktree.
After gwm unlink issue, auto-detection from the branch name
resurfaces if the branch follows <type>/#<N>-<slug>. Idempotent —
safe to run when nothing is linked.
Fields
target: LinkTargetWhat to unlink: issue or pr.
Open
Open the linked issue or PR in the browser.
Uses the OS opener (open on macOS, xdg-open on Linux,
explorer on Windows). Pass --print-url to emit the URL on
stdout instead — useful for piping, testing, and headless shells.
Fields
target: LinkTargetWhat to open: issue or pr.
Status
Show the issue / PR link and (when gh is available) live GitHub status.
Shells out to gh issue view and gh pr view to fetch state, title,
labels, and CI rollup. Without gh (or outside a GitHub repo), prints
only the local link. --json emits a stable schema for scripting.
Fields
Labels
Manage the declarative GitHub label set from .gwm.toml (issue #81).
Declares the desired label set under [[labels]] in .gwm.toml,
then pushes it to the upstream origin remote via gh label create --force. Without a [[labels]] block, both subcommands
are no-ops (0 labels declared, nothing to push).
Fields
action: LabelsActionMilestones
Manage the declarative GitHub milestone set from .gwm.toml (issue #82).
Declares the desired milestone set under [[milestones]] in
.gwm.toml, then pushes it to the upstream origin remote via
gh api repos/:owner/:repo/milestones (no native gh milestone
subcommand exists). Without a [[milestones]] block, both
subcommands are no-ops (0 milestones declared, nothing to push).
Fields
action: MilestonesActionTrust
Manage the TOFU trust ledger for .gwm.toml files (issue #95).
gwm runs [[bootstrap.command]] lines from .gwm.toml under
the user’s privileges — equivalent to curl … | sh against the
repo author. The trust ledger at ~/.config/gwm/trust.toml
(override via $GWM_TRUST_LEDGER) records the (origin URL, sha256 of .gwm.toml) tuples the user has approved, so
subsequent runs skip the prompt. Hash drift (any byte changes
in .gwm.toml) re-prompts — see the module-level comment in
src/trust.rs for the threat model.
Fields
action: TrustActionAliases
List the resolved CLI aliases (built-in + repo + user). Issue #86.
gwm aliases list surfaces every alias reachable from gwm <name>, grouped by source: built-in (clap visible_alias
set), repo (.gwm.toml), user (~/.config/gwm/aliases.toml).
The resolution chain favours repo aliases over user aliases when
both declare the same name, but both rows are still printed so
the user can see what’s being shadowed.
Fields
action: AliasesActionConfig
Read, edit, and validate .gwm.toml values (issue #89).
Fields
action: ConfigActionHistory
List the recent destructive operations recorded by gwm
(issue #29). One line per op, newest first, with timestamp,
kind, and worktree name.
Defaults to the current repo only — pass --all to list ops
across every repo in the journal. The journal file lives at
$GWM_HISTORY_FILE if set, otherwise
$XDG_DATA_HOME/gwm/history.toml.
Fields
Undo
Undo the most recent destructive operation recorded for the current repo (issue #29). Recreates the branch at the saved OID, re-adds the worktree at the saved path, then drops the entry from the journal.
Pass --bootstrap to re-run the per-worktree bootstrap after
the resurrection (off by default — bootstrap can be expensive
and the user often just wants the directory back).
Fields
Tui
TUI introspection / debugging subcommands (issue #87).
Today exposes a single child — keys — which prints the
resolved keymap (built-in defaults layered with [tui.keys]
overrides from .gwm.toml). Reserved as a sub-tree so future
TUI knobs (gwm tui themes, gwm tui dump-state, …) have a
stable home without further crowding the top-level surface.
Theme
TUI theme subcommands (issue #33).
gwm theme list prints the names of every built-in preset.
gwm theme show <name> dumps the preset as a [theme] TOML
block the user can paste into .gwm.toml.
Fields
action: ThemeActionExec
Run a shell command in each worktree, sequentially (issue #313).
gwm exec -- git fetch runs in every non-main worktree; pass slugs
before -- to scope it: gwm exec feat-1 fix-2 -- cargo check.
Prints a per-worktree ✓ / ✗ rollup and exits non-zero if any
worktree’s command failed. Everything after -- is forwarded
verbatim (flags and all). This is the user’s own command against
their own worktrees — no bootstrap trust gate applies (#95).
Fields
slugs: Vec<String>Worktree slugs to target (fuzzy match, before --). Empty = all
non-main worktrees.
profile: Option<String>Run a saved [exec.profiles.<name>] command instead of an inline
-- <cmd> (issue #324). Mutually exclusive with an inline command;
an unknown name exits 1.
Clean
Report (and optionally reclaim) heavy build artifacts across worktrees (issue #313).
Scans each worktree for target/, node_modules/, dist/, build/
and prints the reclaimable size per worktree. Report-only by default;
pass --yes to actually delete. Scope to a subset with slug
positionals: gwm clean feat-1. Deliberately not journaled into
gwm history (#29) — the artifacts are regenerable.
Safety: --yes only deletes directories git treats as ignored. A
non-ignored dist/ / build/ (tracked or hand-authored, hence
non-regenerable) is reported as skipped, never removed.
Trait Implementations§
Source§impl FromArgMatches for Command
impl FromArgMatches for Command
Source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
Source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches,
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>
Source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Source§fn update_from_arg_matches_mut<'b>(
&mut self,
__clap_arg_matches: &mut ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches_mut<'b>( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Source§impl Subcommand for Command
impl Subcommand for Command
Source§fn augment_subcommands<'b>(__clap_app: Command) -> Command
fn augment_subcommands<'b>(__clap_app: Command) -> Command
Source§fn augment_subcommands_for_update<'b>(__clap_app: Command) -> Command
fn augment_subcommands_for_update<'b>(__clap_app: Command) -> Command
Command so it can instantiate self via
FromArgMatches::update_from_arg_matches_mut Read moreSource§fn has_subcommand(__clap_name: &str) -> bool
fn has_subcommand(__clap_name: &str) -> bool
Self can parse a specific subcommandAuto Trait Implementations§
impl Freeze for Command
impl RefUnwindSafe for Command
impl Send for Command
impl Sync for Command
impl Unpin for Command
impl UnsafeUnpin for Command
impl UnwindSafe for Command
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more