Pragmatism in the real world

Global git ignore patterns

One thing that I’ve found helpful is to add a set of patterns to my global git ignore file (config/git/ignore for me) that allow me to create temporary files that are automatically excluded from git.

The patterns I use are these:

# Ignore a file by renaming it with ignore its name
*.ignore
ignore.*
*.ignore.*

This lets me create a file with a prefix ignore., a postfix of .ignore or add .ignore. somewhere in the middle of the filename. This is particular useful for adding before the extension that’s used for syntax detection in an editor, such as with .yaml files.

It’s a small thing, but so convenient when you want to keep a local file around for reference, but never accidentally commit it.

Thoughts? Leave a reply

Your email address will not be published. Required fields are marked *