Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/content/list.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ Output as JSON for scripting:
$ wt list --format=json
```

## Global listing

List worktrees across all projects when `global-worktree-dir` is configured:

```bash
$ wt list --global
```

This scans the global worktree directory and groups results by project.

## Columns

| Column | Shows |
Expand Down Expand Up @@ -289,6 +299,9 @@ Usage: <b><span class=c>wt list</span></b> <span class=c>[OPTIONS]</span>
<b><span class=c>--full</span></b>
Show CI, merge-base diffstat, and working tree conflict check

<b><span class=c>--global</span></b>
List worktrees from all projects in global-worktree-dir

<b><span class=c>--progressive</span></b>
Show fast info immediately, update with slow info

Expand Down
13 changes: 12 additions & 1 deletion docs/content/switch.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,22 @@ If the branch already has a worktree, `wt switch` changes directories to it. Oth

When creating a worktree, worktrunk:

1. Creates worktree at configured path
1. Creates worktree at configured path (see below)
2. Switches to new directory
3. Runs [post-create hooks](@/hook.md#post-create) (blocking)
4. Spawns [post-start hooks](@/hook.md#post-start) (background)

## Worktree placement

By default, worktrees are placed in sibling directories based on the `worktree-path` template. When `global-worktree-dir` is configured, new worktrees are placed there instead using `{project}.{branch}` naming:

```toml
# ~/.config/worktrunk/config.toml
global-worktree-dir = "~/worktrees"
```

This creates worktrees like `~/worktrees/myrepo.feature-auth`.

```bash
wt switch feature # Existing branch → creates worktree
wt switch --create feature # New branch and worktree
Expand Down
31 changes: 28 additions & 3 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1922,6 +1922,16 @@ Output as JSON for scripting:
$ wt list --format=json
```

## Global listing

List worktrees across all projects when `global-worktree-dir` is configured:

```console
$ wt list --global
```

This scans the global worktree directory and groups results by project.

## Columns

| Column | Shows |
Expand Down Expand Up @@ -2123,17 +2133,21 @@ Missing a field that would be generally useful? Open an issue at https://github.
format: OutputFormat,

/// Include branches without worktrees
#[arg(long)]
#[arg(long, conflicts_with = "global")]
branches: bool,

/// Include remote branches
#[arg(long)]
#[arg(long, conflicts_with = "global")]
remotes: bool,

/// Show CI, merge-base diffstat, and working tree conflict check
#[arg(long)]
full: bool,

/// List worktrees from all projects in global-worktree-dir
#[arg(long)]
global: bool,

/// Show fast info immediately, update with slow info
///
/// Displays local data (branches, paths, status) first, then updates
Expand Down Expand Up @@ -2172,11 +2186,22 @@ If the branch already has a worktree, `wt switch` changes directories to it. Oth

When creating a worktree, worktrunk:

1. Creates worktree at configured path
1. Creates worktree at configured path (see below)
2. Switches to new directory
3. Runs [post-create hooks](@/hook.md#post-create) (blocking)
4. Spawns [post-start hooks](@/hook.md#post-start) (background)

## Worktree placement

By default, worktrees are placed in sibling directories based on the `worktree-path` template. When `global-worktree-dir` is configured, new worktrees are placed there instead using `{project}.{branch}` naming:

```toml
# ~/.config/worktrunk/config.toml
global-worktree-dir = "~/worktrees"
```

This creates worktrees like `~/worktrees/myrepo.feature-auth`.

```console
wt switch feature # Existing branch → creates worktree
wt switch --create feature # New branch and worktree
Expand Down
Loading
Loading