ignore-this

TL;DR: the first lines of every root .gitignore should be:

.ignore/     # files that are intentionally untracked and disposable.
.local/      # files that are intentionally untracked but should persist on a developer's machine.

Problem

Imagine the following situation: You are working on a publish script for your project. For testing purposes you’re about to hard-code the password in the script but then you remember how bad it would be if that password was committed in Git and pushed where everyone can see it. You smartly put the password in separate file (password.txt) and diligently add that file to .gitignore to be safe. Then you decide to secrets.json would be a better design so you add that to .gitignore as well.

Secrets are just one example. There is no end of programs out there that create or expect files to be ignored. They should all follow this pattern.

For example, VSCode puts a mix of files in /.vscode/ - some that should be committed and some that should not. It should follow this convention.

Solution

Not Just Git

This recommendation applies regardless of your choice of source control. The common names .ignore/ and .local/ are SCM-agnostic.

License

This work is dedicated to the public domain under CC0 1.0.