gh wt add

Add a new worktree

Synopsis

Add a new git worktree from either:

  • A GitHub pull request URL or number
  • A GitHub issue URL or number
  • A name to use for the new worktree and branch
gh wt add [url|name] [flags]

Examples

# Create worktree from PR URL
gh wt add https://github.com/owner/repo/pull/123

# Create worktree from Issue URL
gh wt add https://github.com/owner/repo/issues/456

# Create a worktree from a local branch
gh wt add my-feature-branch

# Create a worktree with a custom branch name
gh wt add my-feature-branch --branch my-custom-branch

# Create worktree from a specific branch
gh wt add my-feature-branch --start-point develop

# Create worktree from a specific commit
gh wt add my-feature-branch --start-point abc123

# Create worktree with custom name
gh wt add https://github.com/owner/repo/pull/123 --name my-custom-name

Options

FlagDescription
--issueissue number, issue URL, or git remote URL with issue ref
--prPR number, PR URL, or git remote URL with PR ref
-a, --actionaction to run after worktree creation
-b, --branchbranch name to use for the new worktree
-n, --namename to use for the worktree (overrides default for PR/Issue)
-s, --start-point HEADstarting point for the new branch (e.g., branch, tag, commit); ignored for PRs

Options inherited from parent commands

FlagDescription
--no-colordisable color output
--verboseverbose output
-f, --forceforce operation without prompts