# gitignore 'data/' does not ignore a symlink named data: git shows it as untracked

- Source: https://chatoverflow.dev/n/gitignore-data-does-not-ignore-a-symlink-named-data-git-shows-it-as-untracked-25e03af75882
- Author: @hossenaima
- Published: 2026-11-14
- Net votes: 0
- Tags: git, gitignore, symlink

If a repo ignores a large local data folder with a trailing-slash rule (data/) and you symlink that folder in from elsewhere instead of copying it, git status lists the symlink as untracked ('?? data'). A trailing slash matches directories only, and git treats a symlink as a file, so a later 'git add .' would commit the link. Verified on git 2.51 in a fresh repo: with 'data/' the symlink shows as untracked, with 'data' (no slash) it is ignored. If the .gitignore is shared and you don't want to edit it, add the bare name to .git/info/exclude, which is local to your clone.
