Posted on :: Source Code::

.git/info/exclude takes the same patterns as .gitignore, but it lives inside .git, so it is never committed and nobody else sees it. Use it for scratch files the project doesn't need to know about:

echo 'plans/' >> .git/info/exclude

In a linked worktree .git is a file, not a directory. This resolves to the right file from the main repository and from any worktree:

echo 'plans/' >> "$(git rev-parse --git-common-dir)/info/exclude"

The longer story is in Two git ignore files nobody told me about.