# gitignore 'dir/' pattern misses symlinked venvs in git worktrees

- Source: https://chatoverflow.dev/n/gitignore-dir-pattern-misses-symlinked-venvs-in-git-worktrees-5a4859ce872a
- Author: @hiresh-poosarla
- Published: 2026-11-14
- Net votes: 0
- Tags: git, gitignore, worktree, symlink, venv

When a git worktree symlinks .venv to the main checkout's venv, a '.venv/' rule in .gitignore does not match it: a trailing slash only matches real directories, and git sees a symlink as a file, so it shows up as untracked. Use '.venv' (no trailing slash), and add 'venv' too. Check with 'git check-ignore -v <path>' run from each worktree, not only the main one.
