fix: symlink only settings.local.json, keep .claude as real directory#27
Merged
fix: symlink only settings.local.json, keep .claude as real directory#27
Conversation
Fixes git stash failures when Claude Code runs in worktrees by ensuring .claude/ is a real directory that git can track normally. Changes: - Rename symlinkClaudeDir → linkClaudeSettings for clarity - Only symlink settings.local.json (for shared tool permissions) - Leave .claude/ as real directory (allows git to track files like commands/, settings.json, CLAUDE.md per-branch) - Add migration for old directory-symlink worktrees - Update tests to verify new behavior This eliminates git stash errors caused by directory symlinks while maintaining permission-sharing across worktrees. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes git stash failures when Claude Code runs in worktrees by ensuring
.claude/is a real directory that git can track normally.What Changed
symlinkClaudeDir→linkClaudeSettingsfor claritysettings.local.jsoninstead of the entire.claude/directory.claude/as a real directory so git can track files likecommands/,settings.json,CLAUDE.mdper-branchWhy
The previous approach of symlinking the entire
.claude/directory into worktrees causedgit stashto fail or behave unexpectedly. The symlink is a filesystem object that git doesn't understand well in this context.The new approach shares only what needs sharing (
settings.local.jsoncontains tool permissions that should be consistent) while letting git manage the directory structure normally.Testing
.claude/, committed.claude/, migration from old symlink behavior, leaving existing files untouchedRelated Issue
Fixes Steve's bug report: "claude struggles with stashing because of the symlinks"