Extending .gitignore for a set of non-versioned ignores
May 28, 2026 · Jerome Gill
There are occasions when I want files in a repo that should not be versioned but I don’t want to pollute a versioned gitignore with.
an example is a notes text file I often keep in a repo which is just random bullshit that probably belongs in tasks or documenting properly but I haven’t gotten around to yet.
Other examples are artifacts from agentic experiments that don’t need to be shared or remembered but I don’t want to delete yet.
For this, I’ve found the git excludesFile feature a really neat way to manage it.
Basically excludesFile is a set of files that git treats like .gitignore that we all know and love.
git config --global core.excludesFile .gitignore.local
This command sets globally that any .gitignore.local file should be treated as a second .gitignore file.
It gets a bit clunky to describe but if you add .gitignore.local to .gitignore in any directory, you can then have a second set of unversioned ignores.
node_modules
.gitignore.local
notes.txt
It’s pretty handy for kind of a niche use case. But I’ve found it helpful.