Testing Microservice Changes from Git Worktrees End to End Without the Terminal Tab Explosion
Source: Dev.to
TL;DR
I built a visual CLI‑tool called Recomposable to solve the pain of testing Claude‑generated code that lives in Git worktrees.
The Problem
When using Claude Code with Git worktrees you often have several branches of the same repository checked out at the same time:
- Claude works in one worktree.
- You review / run the rest of the stack in another.
This works fine for a single‑service project, but it quickly breaks down for a micro‑services architecture.
You need to verify that the changes Claude made to one service still work with the rest of the stack. That means:
- Rebuilding only that service from the worktree’s code.
- Keeping every other service on the
mainbranch.
Docker Compose has no notion of worktrees – it only sees files on disk – so you end up doing a lot of manual path‑juggling.
Manual Workflow (Current State)
| Step | What you do |
|---|---|
| 1️⃣ Find the worktree path | Claude creates worktrees under .claude/worktrees/ with generated names. bash\ngit worktree list\n# /Users/you/project abc1234 [main]\n# /Users/you/project/.claude/worktrees/jan-abc123 def5678 [fix‑oauth]\n |
| 2️⃣ Build the service from the worktree | Combine the worktree path with the compose file path and specify the service. bash\ndocker compose -f /Users/you/project/.claude/worktrees/jan-abc123/docker-compose.yml build auth-service\n |
| 3️⃣ Start it | bash\ndocker compose -f /Users/you/project/.claude/worktrees/jan-abc123/docker-compose.yml up -d auth-service\n |
| 4️⃣ Verify | Open another terminal, tail logs, hit the service, maybe rebuild if it fails. |
| 5️⃣ Switch back | Repeat steps 2‑3 but point to the original compose file. |
Every step requires you to remember or copy the worktree path, and you must also keep track of which compose file belongs to which service.
There is no overview of which service is running from which branch.
You can hide some of the friction with shell aliases or a Makefile, but you still lack:
- A quick visual cue of which service runs from which worktree.
- Automatic updates when new worktrees appear.
Introducing Recomposable (v1.1.4)
Recomposable is a Docker‑Compose TUI built for development workflows.
Version 1.1.4 adds worktree switching as a first‑class feature.
How it works
- Press
ton any service in the UI. - A picker shows all available Git worktrees (populated via
git worktree list --porcelain). - Use
j/kto navigate,Enterto select. - The service is stopped, rebuilt from the selected worktree’s compose file, and started again.
That’s it – no manual paths, no extra docker compose -f … flags, no extra terminal tabs.
UI Overview
When services run from different branches a WORKTREE column appears automatically.
Non‑main branches are highlighted in yellow.
SERVICE STATUS BUILT PORTS WORKTREE
auth-service running 2m ago 5001 fix-oauth
api-gateway running 1h ago 8080 main
web-app running 3d ago 3000 main
- No need to remember paths.
- No need to guess which branch a container was built from.
Under the hood
- Discovery –
git worktree list --porcelainruns from the compose file’s directory to discover all worktrees. - Mapping – The tool maps the original compose file path to the same relative path inside the target worktree. If the file or service does not exist in the target worktree, an error is shown.
- Override storage – The selected worktree override is stored per‑service, so all subsequent operations (
rebuild,restart,logs,exec,watch, dependency‑aware cascade rebuild) automatically use the overridden compose file. - Switch back – Press
tagain and pick the original worktree (usuallymain).
Typical workflow with Recomposable
- Start Recomposable in your project root – the full stack runs on
main. - Open Claude Code and tell it to work on
auth-servicein a new worktree. - Claude makes changes; you need to verify end‑to‑end.
- In Recomposable, navigate to
auth-service, presst, select Claude’s worktree. - The service rebuilds from Claude’s branch while the rest of the stack stays on
main. - Inspect logs, send requests, verify behavior – all inside the TUI.
- When finished, press
tagain and switch back tomain.
No extra terminal tabs, no path juggling, no guessing.
The approach scales: if Claude works on three services across two worktrees, you can switch all three, and the WORKTREE column instantly tells you what’s running where.
Future‑Proofing the Feature (Ideas & Gaps)
| Area | Current state | Possible improvement |
|---|---|---|
| Auto‑detect worktree changes | You must manually press t. | Watch for new worktrees (e.g., when Claude creates one) and prompt the user to switch the affected service automatically. |
| Worktree‑aware cascading rebuilds | Dependency‑aware rebuild (d) restarts transitive dependents, but they stay on their current worktree. | Add a “cascade switch” that, when a service is switched, also switches its dependents to the same worktree (optional toggle). |
| Diff preview before switching | No preview; you rebuild blindly. | Show a summary of changed files / services between the current compose file and the target worktree before rebuilding, letting the user decide if the switch is worth it. |
| Branch status indicators | Only the worktree name is shown. | Display whether the worktree’s branch is ahead/behind main, or has uncommitted changes, to help decide which worktree to test. |
| Batch operations | Switch services one‑by‑one. | Allow selecting multiple services in the UI and switching them all to the same worktree in one action. |
| Persisted profiles | Overrides are per‑service and volatile. | Save named “profiles” (e.g., Claude‑Auth) that capture a set of service‑to‑worktree mappings, loadable with a single command. |
Implementing any of these would make the tool even more powerful for teams that heavily rely on the Claude Code + worktree pattern.
TL;DR (again)
- Problem: Verifying Claude‑generated changes across multiple micro‑services requires tedious manual worktree path handling.
- Solution: Recomposable – a Docker‑Compose TUI that lets you switch any service to any Git worktree with a single keystroke, showing the current worktree per service in a clear table.
- Result: No more copy‑pasting paths, no extra
docker compose -f …flags, and an at‑a‑glance view of which branch each container runs from.
Give it a try, and let the UI do the heavy lifting for you!
# Recomposable – Multi‑service Worktree Switch
> “0 commits ahead” is a different risk profile than a change that only touches a single config file.
## What it does
Recomposable lets you switch **all services** in a repository from one Docker Compose file to the same worktree with a single action.
When a change spans multiple services, you no longer have to switch each service individually – the friction disappears.
## Installation
```bash
npm install -g recomposable
Quick start
-
Navigate to a directory that contains a
docker‑compose.ymlfile. -
Create a
recomposable.jsonthat points to the compose files you want to manage. -
Run the tool:
recomposable
The worktree feature works out‑of‑the‑box with any Git repository that has multiple worktrees.
Links
- GitHub:
- npm:
## What it does
Recomposable lets you switch **all services** in a repository from one Docker Compose file to the same worktree with a single action.
When a change spans multiple services, you no longer have to switch each service individually – the friction disappears.
## Installation
```bash
npm install -g recomposable
Quick start
-
Navigate to a directory that contains a
docker‑compose.ymlfile. -
Create a
recomposable.jsonthat points to the compose files you want to manage. -
Run the tool:
recomposable
The worktree feature works out‑of‑the‑box with any Git repository that has multiple worktrees.
Links
- GitHub:
- npm: