TIL: Ignoring other people's gits

EmeliaAug 10, 2026

One of the tricks that I've learned over the years is that if you're working in someone else's repo, git can be kind of annoying. Not in a bad way, but in a way where, for instance, maybe you want to keep a notes file so that you can keep track of your notes within the repo without having to pester or bother the maintainers of the repo to add your notes.md file to their .gitignore.

Well, it turns out that there's a solution for that, and it's pretty damn simple:

$ ln -s .git/info/exclude .gitignore_local 
$ echo ".gitignore_local" >> .gitignore_local

That's the setup.

What is this actually doing? Good question. From what I can tell, it's telling the git repository, "hey, also ignore these files in the exclude file". It's similar to the setting core.excludesFile, which is usually set to ~/.gitignore_global. What's that?! A twofer?!

The reason for symlinking that file to .gitignore_local in the repository is because a lot of code editors will hide the .git directory by default. We ignore .gitignore_local as we don't want that to be tracked ever, and it's as if you never even touch the repository.

The only bad part is it is strictly local. There is no backup, it doesn't travel across clones, so use it sparingly. For instance, in repositories I dip in and out of regularly, I use it to keep track of a notes.md file and similar notes for myself. That's one way I use to way-find and get myself back up to speed with projects when I've not been actively working on them for a while.

I'm not actually sure if it works with `git worktrees` , someone should look that up and let me know.

P.s., Claude read this article and ever helpfully informed me that if you want this to work for git worktrees, then you'd need to use:

$ ln -s "$(git rev-parse --git-path info/exclude)" .gitignore_local
$ echo ".gitignore_local" >> .gitignore_local

This is because linked worktrees have a .git file pointing at the main repo, rather than a .git directory.


Log in to leave a note.