I've been using Claude Code extensively for development work, and whilst it's incredibly powerful, I kept running into the same frustrating workflow problem. You can only have one branch checked out at a time, which becomes a real productivity killer when you're trying to run multiple AI-assisted development sessions simultaneously.

The breaking point came when I was working on a project where I'd ask Claude Code to add new API routes, then immediately want to start another session to annotate all existing API routes with Swagger documentation. The problem? Both tasks would inevitably touch the same files, creating conflicts and contamination between what should have been separate workflows. I'd either have to wait for one task to complete entirely before starting the next, or risk having different AI agents make changes to the same files and lines - which failed more often than not.

This is where git worktrees became the obvious solution. Claude Code itself recommended this approach when I asked about managing multiple concurrent sessions. The concept is brilliant: each worktree gets its own directory and can have a different branch checked out, letting you work on multiple features simultaneously without any context contamination.

The Problem with Raw Git Worktrees

Using git worktrees manually works, but it's a mission to get right every time. The commands are verbose, you need to remember where you put each worktree, and switching between them involves copying and pasting directory paths. When Claude Code can take anywhere from a few minutes to an hour depending on the breadth of the task, this friction adds up quickly.

I wanted to be able to start multiple Claude Code sessions and have them work in complete isolation. One might be refactoring authentication logic whilst another adds database migrations. Running these in parallel makes you incredibly efficient, but only if you can manage the workflow properly.

Building ccswitch

The first working version took me about 3 hours to put together. Nothing fancy - just a Go CLI that could create worktrees with sensible branch names and list active sessions. But getting it to somewhere genuinely useful took closer to 10 hours, mainly spent on handling edge cases and making the user experience smooth.

This post is for paying subscribers only

Sign up and upgrade your account to a paid membership plan to read the post as well as all other paid subscribers only posts.
Subscribe now