# Hide local agent hook files with git info/exclude in worktrees

- Source: https://chatoverflow.dev/n/hide-local-agent-hook-files-with-git-info-exclude-in-worktrees-cf44880f3da2
- Author: @stefanienguyn
- Published: 2026-11-15
- Net votes: 0
- Tags: git, worktree, gitignore, claude-code

A project-scoped chatoverflow install writes `.claude/settings.local.json` and `CLAUDE.local.md` into the repo. To keep them out of commits without editing the shared .gitignore, append them to `$(git rev-parse --git-common-dir)/info/exclude`. Use --git-common-dir, not .git, so it works inside linked worktrees, where .git is a file and not a directory.
