Infrastructure for running multiple parallel GitHub Copilot CLI sessions using git worktrees and devcontainers.
Inspired by Jesse Vincent's workflow.
This repository provides reusable infrastructure (Windows host + PowerShell) that enables:
- Parallel development: Work on multiple branches simultaneously, each in its own container
- Isolated environments: Each worktree gets its own devcontainer with isolated state
- Easy setup: PowerShell scripts automate worktree creation and container management
- Project-agnostic: Copy these files to any project to enable multi-copilot workflows
Copy the following to your project:
.devcontainer/- Devcontainer configurationscripts/- Worktree management scripts.gitattributes- Ensures shell scripts have correct line endings
Edit .devcontainer/Dockerfile to add your project's dependencies (languages, tools, etc.).
Edit .devcontainer/devcontainer.json to:
- Change the
nameto your project name - Update VS Code extensions for your tech stack
Set these on your Windows host:
# Required: GitHub authentication
$env:GH_TOKEN = (gh auth token)
# Optional: Git identity
$env:GIT_USER_NAME = "Your Name"
$env:GIT_USER_EMAIL = "your.email@example.com"
# Optional: SSH commit signing
$env:GIT_SIGNING_KEY = "id_ed25519" # or your key nameOption A: PowerShell scripts (for parallel Copilot CLI sessions)
.\scripts\worktree-up.ps1 feature-branchOption B: VS Code (for single-session development)
Open the folder in VS Code with the Dev Containers extension installed. VS Code will prompt to reopen in container.
This will:
- Create a git worktree at
.worktrees/feature-branch/ - Start a devcontainer for that worktree
- Configure Copilot CLI
- Launch Copilot in the container
Inside the container, run:
bash scripts/smoke-test.sh.\scripts\worktree-status.ps1# Remove a specific worktree and its container
.\scripts\worktree-down.ps1 feature-branch
# Clean up orphaned containers and project volumes (prompts first)
.\scripts\worktree-cleanup.ps1Git worktrees allow multiple working directories linked to the same repository. Each worktree can be on a different branch, enabling parallel development without stashing or committing.
Worktrees are created in .worktrees/ inside your repo (gitignored).
Branch Switching: You can switch branches inside a worktree with git checkout. The scripts identify worktrees by directory name (not current branch), so worktree-up and worktree-down work correctly even after switching branches.
Each worktree gets its own Docker container with:
- Isolated filesystem
- Pre-configured Copilot CLI (yolo mode by default)
- Git authentication via
GH_TOKEN
The tricky part is that git worktrees on Windows use host paths, but inside containers we need container paths. The scripts handle this by:
- Mounting the main
.gitdirectory at a known location - Rewriting worktree
.gitfiles to use container paths - Restoring host paths when exiting
.devcontainer/
├── devcontainer.json # Container configuration
├── Dockerfile # Build dependencies (customize this)
├── copilot-config.json # Copilot CLI settings (yolo mode)
├── mcp-config.json # MCP server configuration
└── setup-git-auth.sh # Configure git authentication
scripts/
├── worktree-up.ps1 # Create worktree + start container
├── worktree-down.ps1 # Remove worktree + stop container
├── worktree-status.ps1 # Show all worktrees and container status
├── worktree-cleanup.ps1 # Clean up orphaned containers
├── smoke-test.sh # Verify devcontainer setup
└── README.md # Script documentation
Edit .devcontainer/mcp-config.json:
{
"mcpServers": {
"your-server": {
"type": "stdio",
"command": "npx",
"args": ["-y", "your-mcp-server"],
"env": {
"API_TOKEN": "${YOUR_API_TOKEN}"
}
}
}
}Then add the env var to remoteEnv in devcontainer.json.
Add to remoteEnv in devcontainer.json:
"remoteEnv": {
"MY_TOKEN": "${localEnv:MY_TOKEN}"
}- Windows with PowerShell 5.1+ (scripts are PowerShell/Windows-focused)
- Git with worktree support
- Docker Desktop
- Node.js (for devcontainer CLI)
- GitHub CLI (
gh) for authentication
Copyright 2026 James Casey
SPDX-License-Identifier: Apache-2.0