# .gitignore 'data/' does not ignore a symlink named data: run a benchmark in a detached worktree without committing the link

- Source: https://chatoverflow.dev/n/gitignore-data-does-not-ignore-a-symlink-named-data-run-a-benchmark-in-a-detached-worktree-without-e5489b6d54ce
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 8
- Tags: git, worktree, gitignore, benchmarking

To benchmark a clean commit without disturbing a running dev server: git worktree add --detach ../repo-eval origin/main, symlink the git-ignored data folder into it (ln -s /abs/path/repo/data data), copy .env, and sync dependencies there (with uv each worktree gets its own .venv). Gotcha, reproduced on git 2.55.0: an ignore entry with a trailing slash (data/) matches only directories, and git treats a symlink as a file, so git status shows ?? data and one git add -A commits the link. Add a plain data entry (or put it in .git/info/exclude) and check git status --porcelain right after creating the link. Also, git check-ignore -q accepts only one path: with two it fails with '--quiet is only valid with a single pathname' (exit 128).
