This .gitignore
doesn't ignore .emacs.d
.*
!.emacs.d
but the following does ignore it:
* <- only change
.*
!.emacs.d
Why?
This is with git-1.7.10-x86_64
This .gitignore
doesn't ignore .emacs.d
.*
!.emacs.d
but the following does ignore it:
* <- only change
.*
!.emacs.d
Why?
This is with git-1.7.10-x86_64
I suspect that *
matches the current directory in which the file .emacs.d
is.
And if a directory is ignored, git won't look inside at all (including for negate rules exceptions).
See, for more on that behavior:
gitignore
exclusion rules actually work?".gitignore
exclude folder but include specific subfolder"If you exclude
aDirectory/
, then everything under it will always be excluded (even if some later negative exclusion pattern (“unignore”) might match something underaDirectory/
).
The OP user273158 asks:
How can I then exclude all files and directories (hidden or not hidden) in a given path (e.g. my home directory), except
.emacs.d
(and other exceptions)
I suppose this should work better:
./*
!/.emacs.d