How to I add something to the .gitignore
so that the match is not recursive?
For example, I wish to ignore the directory foo
and the file
From the gitignore manpage:
An optional prefix ! which negates the pattern; any matching file excluded by a previous pattern will become included again. If a negated pattern matches, this will override lower precedence patterns sources.
So !*
as the first line in your .gitignore will clear all previous patterns.