Skip to content

Branches and targets

Every Git-backed task worktree has a current branch. The app also records where that branch started and which branch it should be compared with or merged into.

TermMeaningWhere it matters
Current branchThe branch checked out in this worktreeCommits, pushes, and pull-request source
Base branchThe branch or revision used to create the worktreeInitial files and history
Default branchThe project’s preferred base for new worktreesThe normal + and flow
Target branchThe branch this worktree is reviewed and merged againstDiffs, changed-file counts, behind state, PR/MR target, and review prompts
UpstreamThe remote-tracking branch associated with the current branchFetch, ahead/behind state, pull, and push

These values often point to main and origin/main, but they solve different problems. Do not infer one from another.

Click + or press to create a task worktree from the project’s default branch.

With Settings → Worktrees → Automatic worktree naming enabled—the default—the app creates the worktree immediately with a temporary sc- name. The first meaningful task prompt is used once to generate a durable branch and worktree name. Setup chatter and empty messages do not consume that naming opportunity.

The built-in rule uses kebab-case and a Conventional Commits-style prefix:

feat/api-docs
fix/login-timeout
refactor/sidebar-state
docs/install-guide
chore/update-fixtures
test/settings-round-trip
ci/release-workflow
perf/file-index
style/format-docs
build/update-toolchain

Edit branch naming rules under Settings → Agents. Rules cascade global → workspace → project, so a repository can require a ticket or other local convention without changing every workspace.

For example:

Use {ticket}/{short-description} in kebab-case, such as ENG-1234/login-timeout.

Disable automatic naming when you want to enter the name before the worktree is created. The normal + flow then opens a naming form.

You can also rename an existing temporary branch from an app-launched worktree terminal:

Terminal window
sc worktree rename-branch feat/api-docs

Run this command from the intended worktree. It is useful for CLI-created worktrees, naming failures, or deliberate manual recovery; it is no longer a required first step in the default UI flow.

If the bundled sc helper is not ready when automatic naming starts, the app shows the problem and opens the manual naming form. Finish the rename before using normal review and shipping actions.

Press or choose New worktree from… to open the creation picker. It has up to three sources:

  • Prompt creates a task from a prompt, provider, and base branch.
  • Branches lists local and remote branches.
  • PRs/MRs lists forge reviews when authenticated gh or glab support is available.

A branch already checked out in another worktree is marked In workspace. Git normally permits a local branch to be checked out in only one worktree at a time.

Starting from a PR or MR restores its source and target context. Starting from another branch does not permanently change the project’s default branch.

Set both values in project settings:

  • Default branch supplies the normal starting point for future worktrees.
  • Default target branch supplies the initial review and merge target for future worktrees.

Changing a project default does not silently rewrite the branch or target of existing worktrees. Each task keeps its own target so a release branch, stacked change, or backport can remain accurate.

Read the current worktree state from an app-launched terminal:

Terminal window
sc worktree status --json

Change only this worktree’s target when you intend to change its comparison and merge destination:

Terminal window
sc worktree set-target-branch release/2026-05

The target powers changed-file summaries, review diffs, behind indicators, action prompts, and pull-request creation. Folder names, origin/HEAD, and the current branch name are not authoritative substitutes.

When a worktree has an associated pull request or merge request, the app also reads the forge’s base branch and review state. If the local target and forge target differ, correct the mismatch before relying on the diff or merging.

The active worktree refreshes forge context directly. Inactive worktrees use cached and batch-refreshed context until you return, which limits background forge traffic.

Fetching updates remote-tracking references. Optional settings under Settings → Worktrees → Syncing can then fast-forward:

  • Clean worktree branches after fetch.
  • The clean default branch after fetch.

Fast-forwarding applies only when Git can update safely without rewriting local work. Dirty or diverged worktrees still require an explicit merge, rebase, or other Git decision.

Before shipping, confirm:

  • The current branch has a durable name.
  • The target is the branch you intend to merge into.
  • The upstream points to the expected remote branch.
  • The branch is not unexpectedly behind or diverged.

Compact sidebar hover cards and Detailed sidebar rows show the same branch and Git state. Enable sidebar commit status in Settings → Appearance if you want local commit and push state visible before PR status takes over.