1

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

Amelio Vazquez-Reina
  • 91,494
  • 132
  • 359
  • 564

1 Answers1

2

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:

If you exclude aDirectory/, then everything under it will always be excluded (even if some later negative exclusion pattern (“unignore”) might match something under aDirectory/).

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
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks! 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)? – Amelio Vazquez-Reina Nov 02 '12 at 17:58
  • @user273158 I think that is precisely what shows the first link I reference in the answer: http://stackoverflow.com/a/3001967/6309 – VonC Nov 02 '12 at 18:49