Hi guys,
Maybe I'm doing it wrong, or maybe it's the intended behaviour,
but I find that a trailing whitespace after a pattern in .gitignore
makes the pattern void with git 1.8.1.5.
It's a subtle error to make, although cleaning undesired commits
from the git history can be educational and fun in itself.
How to reproduce:
$ > mkdir -p ~/tmp/git-ignore-test/ \
&& cd ~/tmp/git-ignore-test/ \
&& touch .gitignore .secret-passwords .secret-passwords.swp \
&& echo ".*.sw? " > .gitignore \
&& echo ".secret-passwords" >> .gitignore \
&& git init && git status
Remove the white space after ``` .*.sw?``` in .gitignore
to see the .swp file disappear:
$ > echo -e ".*.sw?\n.secret-passwords" > .gitignore > .gitignore \
&& git status
You will of course have to temporarily disable your
global .gitignore file if you handle vim swap files correctly there.
I am using git 1.8.1.5 installed with homebrew on os x 10.8.2.