I’ve been using Claude Code, Anthropic’s CLI for AI-assisted coding, to help with a side project. Recently I started running multiple sessions in parallel using claude-squad, which spins up isolated instances via git worktrees. It’s a great workflow, but I ran into a minor annoyance.
The Problem
When using claude-squad, each worktree gets its own .claude/ directory. Claude Code stores per-project permissions in .claude/settings.local.json - this file stays in .gitignore since it contains local preferences rather than project configuration.
The problem: every time claude-squad creates a new worktree, you start with a fresh settings.local.json. Any permissions you’ve granted (like allowing ./gradlew build to run without prompting) need to be re-approved in each session.
1 | $ git worktree list |
Three worktrees means three separate permission configs. Tedious.
The Solution
Git’s post-checkout hook fires when a new worktree is created. By detecting when the previous HEAD is null (all zeros), we can identify new worktree creation and automatically symlink the settings file back to the main worktree.
Create the hook
Add this script to .git/hooks/post-checkout:
1 |
|
Update MAIN_WORKTREE to point to your primary checkout location.
Make it executable
1 | chmod +x .git/hooks/post-checkout |
Fix existing worktrees (optional)
For worktrees that already exist, create the symlink manually:
1 | mkdir -p .claude |
Verification
Create a new worktree and check for the symlink:
1 | $ git worktree add ../test-worktree main |
To verify Claude Code is actually reading from the symlink, you can add a test permission to the main settings file and confirm it works in the worktree session without prompting.
Result
All worktrees now automatically share the same Claude Code permissions. Grant a permission once in any session, and it applies everywhere. The hook is idempotent (safe to run multiple times) and non-destructive (won’t overwrite existing non-symlink files without explicit removal).
One less thing to think about when spinning up parallel Claude sessions.










