🖥️Advanced

Desktop & Git Worktrees

Run Claude Code in the desktop app, orchestrate local + cloud agents, and merge parallel work via worktrees.

Claude Code in the Desktop App

Claude Code is integrated into the Claude desktop and mobile applications. The Code tab opens a workspace where you select a project folder and interact with the codebase. Same engine, same configuration (CLAUDE.md, MCP servers, hooks) as the CLI — just a graphical interface.

Local Worktree vs Cloud Mode

ModeWhere It RunsUse Case
Local worktreeYour machine, using Git worktrees for parallel branchesActive hands-on development, full local control
Cloud (background agents)Anthropic-managed containers with GitHub repo accessBackground tasks, parallel scaling, mobile usage

Cloud mode requires granting Claude Code web permission to your GitHub repositories. Once authorized, Anthropic spins up a containerized Claude instance per task. The instance clones the repo, works on the code, commits changes, and creates pull requests — independent of your local machine.

Git Worktrees Explained

Git worktrees let you check out multiple branches of the same repository into separate directories simultaneously, without cloning multiple times. Local worktree mode in Claude Code creates an auto-named worktree (e.g., vigilant-feistel) for each parallel task. Each runs in its own directory, on its own branch, with a full copy of the codebase.

text
~/.claude-worktrees/
  claude-code-crash-course/      ← original repo (project/hookhub branch)
  vigilant-feistel/              ← worktree 1 (vigilant-feistel branch)
    hookhub/                     ← full Next.js copy
  zealous-jemison/               ← worktree 2 (zealous-jemison branch)
    hookhub/                     ← full Next.js copy
💡Tip

The main branch (project/hookhub) stays untouched while worktrees evolve. If you like a worktree's work, merge it. If not, delete the worktree and branch — no mess on the main branch.

Parallel Local + Cloud Workflow

The desktop app enables a hybrid pattern: run the main implementation locally for tight iteration, dispatch research or background tasks to cloud agents, and assign feature branches to additional local worktrees — all concurrently.

  • Local session 1 — implement UI animations on a worktree branch (vigilant-feistel)
  • Local session 2 — update database config on a separate worktree (zealous-jemison)
  • Cloud background agent — redesign hero section on remote branch (claude/anthropic-hero-design-XXX)
  • Claude Desktop chat — research task collecting popular GitHub hook repositories

Merging Parallel Branches

After parallel work completes, three branches need consolidation: the remote cloud branch and two local worktree branches. Instead of manual merging, instruct Claude Code to merge them. Claude creates a temporary integration branch (e.g., project/hookhub-merge) to consolidate before touching the main development branch — a safe staging step.

bash
# Prompt Claude Code in any session
> Merge all the commits here to branch project/hookhub

# Claude creates a temporary integration branch first
> project/hookhub-merge  ← new staging branch

# Merges each feature branch in sequence
> git merge claude/anthropic-hero-design-XXX
> git merge vigilant-feistel
> git merge zealous-jemison

# Resolves conflicts (CSS, README, page.tsx) with your approval
# Then pushes the consolidated branch back to project/hookhub

Always Test Before Final Push

After merge consolidation, do not approve the push to the main branch immediately. Instruct Claude to start the dev server in the merged worktree and validate the integrated result locally. Compare against the original to confirm all three feature branches coexist correctly. Approve the push only after visual confirmation.

Mobile via Cloud

The Claude mobile app supports the same Claude Code workflow. Because mobile cannot execute code locally, every operation runs in the Anthropic cloud — repo clone, branch checkout, commits, pushes all happen remotely. This enables continuing development from a phone with the full power of cloud agents, no local machine required.

⚠️Warning

Parallel agents are not always faster. Three concurrent sessions on overlapping files cause merge conflicts. Coordinate via clear file scoping ("modify only src/components/HookCard.tsx") or via separate worktrees on independent branches. When tasks share state, sequential is safer.

Before you continue

We use analytics cookies to understand how the documentation is used and improve the experience. Privacy Policy.