worktree branch
Create a new branch in a dedicated worktree.
Usage
worktree branch <name>
worktree branch <name> --source <remote-branch>
worktree branch --github <issue-number>
worktree branch --jira <issue-id>Examples
worktree branch feature/add-bulk-actions
worktree branch feature/add-bulk-actions --source origin/release/1.4
worktree branch --github 42
worktree branch --github "#42"
worktree branch --jira DEV-123
worktree branch --jira dev-123GitHub Issue Branching
Use the --github flag to create a suggested branch name from an issue in the current repository.
- The issue number can be passed as
42or"#42". - The generated name is pre-filled in the prompt and still editable.
- If issue types are configured in the repository, these optional prefixes are applied:
branchPrefix.featurefor issue typeFeaturebranchPrefix.bugfixfor issue typeBugbranchPrefix.chorefor issue typeTask
If no prefix is configured, worktree falls back to an empty prefix and still generates a valid branch name.
GitHub authentication is resolved in this order:
northguild.worktree.github.tokenfrom local git config.gh auth tokenif GitHub CLI is installed and authenticated.- Interactive token prompt, which is then saved in local git config.
Jira Issue Branching
Use the --jira flag to create a suggested branch name from an issue in your Jira workspace.
- The issue ID can be passed in any case (
dev-123,DEV-123, etc.). - The generated name is pre-filled in the prompt and still editable.
- If issue types are configured in the repository, these optional prefixes are applied:
branchPrefix.featurefor issue types likeFeature,Story, and most non-bug/chore typesbranchPrefix.bugfixfor issue typeBugbranchPrefix.chorefor issue typeTask
If no prefix is configured, worktree falls back to an empty prefix and still generates a valid branch name.
Jira authentication requires three configuration keys:
northguild.worktree.jira.host- Your Jira workspace URL (e.g.,https://company.atlassian.net)northguild.worktree.jira.email- Your Jira email addressnorthguild.worktree.jira.apiToken- Your Jira API token
What It Does
- Creates a branch from your configured source branch.
- Adds a worktree under
<repo>.worktrees/<branch-name>. - Copies
.envfiles into the new worktree. - Opens the worktree in your configured editor (if configured).
Last updated on