Skip to content

Instantly share code, notes, and snippets.

Created September 25, 2012 07:21
What would you like to do?
Double negation in gitignore

Usually .gitignore is used to exempt certain files and directories from being reported by git status. The name .gitignore itself also suggests such usage. But when one does some experiments in sandbox directory, only a small portion of files are worth being version controlled. Instead of telling git what to exclude, it is more convenient to tell it what to include. Spotted such a .gitignore pattern today and it goes like this:

# Ignore all

# Except

# Include js directory

It is quite a novelty for me. Double negation FTW!

As a sidenote, there are some links regarding .gitignore:

Ignoring files

gitignore templates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment