GitButler ⧓

Commands
>_

but worktree

Manage worktrees.

Without a subcommand, lists the worktrees.

Usage: but worktree <COMMAND>

Subcommands

but worktree list

List worktrees, most recently updated first.

By default this lists every active worktree and the three most recently updated archived ones. A worktree is shown by its name, followed by the branch it has checked out when that differs from the name, and its path.

Usage: but worktree list [OPTIONS]

Options:

  • --archived — List all archived worktrees
  • --active — List all active worktrees

but worktree new

Create a worktree on a new branch at the workspace base or above a commit, or on an existing branch that isn't in the workspace.

By default, a new branch starts at the child-most commit any applied stack rests on, and is checked out under ~/.gitbutler-worktrees/<repo-dir-basename>/ in a directory named by a slug of the branch name (or wt if the slug is empty). If that directory is taken, retries up to five times with a random ASCII suffix.

Worktree creation supports simple .worktreeinclude files with paths to files or directories. Untracked files are copied if any prefix of their path is in the .worktreeinclude file and they are also gitignored.

Usage: but worktree new [NAME] [OPTIONS]

Arguments:

  • <NAME> — The branch to check out, created if it doesn't exist, or a generated one

Options:

  • -A, --above <COMMIT> — Start the new branch at COMMIT instead of the workspace base.

Accepts a commit SHA or CLI ID, not a branch. Conflicted commits are refused.

but worktree archive

Hide a worktree from the workspace

Usage: but worktree archive <WORKTREE>

Arguments:

  • <WORKTREE> — The worktree, by CLI ID (see but wt list) or name (required)

but worktree unarchive

Show an archived worktree in the workspace again

Usage: but worktree unarchive <WORKTREE>

Arguments:

  • <WORKTREE> — The worktree, by CLI ID (see but wt list) or name (required)

but worktree remove

Remove a worktree from disk, like git worktree remove.

This works on archived and locked worktrees too, and keeps the branch the worktree had checked out.

Usage: but worktree remove <WORKTREE> [OPTIONS]

Arguments:

  • <WORKTREE> — The worktree, by CLI ID (see but wt list) or name (required)

Options:

  • -f, --force — Remove the worktree even if it has uncommitted changes

Last updated on

On this page

Edit on GitHubGive us feedback