As developers, we often create temporary files or debug utilities during development.
But what if you don’t want these debug files:
- to show up in
git status - or accidentally be committed
- yet you don’t want to edit
.gitignore— especially in a shared codebase
Use .git/info/exclude
Git has a local-only ignore file, specific to your repo clone located at .git/info/exclude
Anything you add there behaves just like .gitignore, but:
- It’s not version-controlled
- It won’t affect your teammates
- It’s perfect for one-off debug or temp files
Why I Use This
I had a helper function called useRenderCount() to count component renders while debugging a React app.
I didn’t want to commit it by accident or to pollute the shared .gitignore
Adding it to .git/info/exclude let me:
- keep the file locally
- use it freely
- never worry about it ending up in Git
Top comments (0)