25

These files should all be ignored:

.weirdBackupFileType
.travis.yml

The following files should not be ignored:

_.weirdBackupFileType
Z.travis.yml
BerndBrot
  • 1,403
  • 2
  • 11
  • 9
  • 1
    I might suggest fixing the title a bit, as "empty file names" doesn't seem to quite fit... Maybe "hidden files" or "dot files" or something... Although, I have to admit, the only reason I looked at this question was to see exactly what an "empty file name" was... – twalberg Jul 18 '12 at 15:35

2 Answers2

26

If you want to ignore all dotfiles, add this in your .gitignore file (If it doesn't exist, add it)

.*
!.gitignore
dulvac
  • 289
  • 3
  • 3
2

Your answer is very simple:

This is the content of your .gitignore file:

# ignore those files 
.weirdBackupFileType
.travis.yml

#DONOT ignore those files (this is what the ! is for - un ignore files)
!_.weirdBackupFileType
!Z.travis.yml

And that's it.

In the image you can see that i have created the file and after adding it to the .gitignore they are not in the status any more.

enter image description here

CodeWizard
  • 128,036
  • 21
  • 144
  • 167