Git's Other Ignore File


Requirements


Everyone uses .gitignore, nobody pays attention to .git/info/exclude.

As usual, you echo the name of a file which should be ignored:

1touch ${file}
2git status -s
3echo ${file} > .git/info/exclude
4git status -s

Unlike the regular .gitignore, it's not checked into the repository, which means it stays there, even after switching branches.

This other ignore file pairs well with make for when you need to dynamically generate ignore rules.

1ignored += $(wildcard *.pdf)
2ignored += $(wildcard */*.aux)
3ignored += $(wildcard */*.log)
4
5.git/info/exclude: | $(ignored)
6	echo $| | tr ' ' '\n' > $@
7