Worktrees
Git worktrees let you have multiple branches checked out simultaneously, each in its own directory. ServerCC provides full worktree management — create, switch, merge, and delete worktrees without leaving the app.
Worktrees require all three conditions: (1) Git installed on the server, (2) the workspace is a Git repository, and (3) the repository has at least one commit. If any condition is not met, the Create Worktree button will be disabled with a hint.
Worktree List
In the session picker, the worktree section shows all active worktrees for the current workspace. Each worktree displays:
- Branch name — The Git branch associated with this worktree
- Working directory status:
- ● Clean — No uncommitted changes
- ● Dirty — Has uncommitted changes
- Merge status:
- ● Ready to Merge — Has commits ahead of the base branch, can be merged
- ● Merge Conflict — Merge conflict detected (dry-run check), needs manual resolution
- ● Merged — The branch's work is already contained in the base branch — detected even across squash or rebase merges
- Commit counts — Number of commits ahead (↑) and behind (↓) the base branch
- Last commit — Subject line of the most recent commit
Statuses are computed when the list loads; tap Refresh Worktrees at the bottom of the section to re-scan after committing or merging from the terminal.
Creating a Worktree
Tap the Create Worktree button in the session picker.
Enter a branch name
Choose a name for the new branch (e.g., feature/login, fix/header-bug). ServerCC validates that the name doesn't already exist.
Select a base branch
Choose which branch to create the worktree from. Defaults to the current branch.
Create
ServerCC creates the worktree with a new branch based on the selected base branch. The new worktree directory is placed at ~/.servercc/worktrees/<workspace>/<branch>/.
Working in a Worktree
Tap any worktree in the list to open it. This navigates into the worktree directory and opens a Claude Code/Codex session scoped to that branch. The workspace name in the title bar shows the branch: ProjectName (feature-branch).
Each worktree has its own independent set of sessions — they don't share session history with the main workspace or other worktrees.
You can background a worktree session and open another worktree or the main workspace simultaneously. Each runs as an independent background instance.
Merging a Worktree
When your work on a branch is complete, you can merge it back into the main branch directly from ServerCC.
Swipe right on the worktree to reveal the Merge button. The merge action is only available when the worktree status shows Ready to Merge (has commits ahead and no conflicts).
ServerCC merges the branch into the current branch. A merge commit is always created for a clear history.
On success, the worktree directory and branch are automatically deleted (cleanup).
If merge conflicts occur, the merge is automatically aborted to restore a clean state. The worktree is preserved. You can resolve conflicts manually via the terminal and retry, or use the Merge Conflict status indicator as a hint to fix conflicts before merging.
Deleting a Worktree
Swipe left on a worktree to reveal the Delete button. This removes the worktree directory and deletes the associated Git branch. Use this when you want to discard the branch entirely.
Worktrees with a running background instance will show a Running badge and cannot be opened until the instance is stopped. Stop the instance from the Running tab first.
Worktree Storage
Worktrees are stored on the server at:
~/.servercc/worktrees/<workspace-name>/<branch-name>/
Each worktree is a standard Git worktree — you can also interact with them via git worktree commands in the terminal or on desktop.