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
.gitignore
# Include js directory
!js/
js/*
!js/*.js
It is quite a novelty for me. Double negation FTW!
As a sidenote, there are some links regarding .gitignore: