Reputation: 11
I want to ignore all the files in my git repository whose name does not contain any '.' (period). How to make git ignore them?
Upvotes: 0
Views: 62
Reputation: 489083
Ignore everything: *
Un-ignore directories, so that Git will look inside directories: !*/
Un-ignore files with at least one dot: !*.*
The resulting .gitignore
consists of those three lines, in that order:
$ cat .gitignore
*
!*/
!*.*
$ git ls-files --other
.gitignore
foo
foo.txt
sub/bar
sub/bar.y
$ git status --short -uall
?? .gitignore
?? foo.txt
?? sub/bar.y
(While this does work, it may not be the best overall strategy: as Yunnosch suggested in a comment, it might be better, strategically, to put the generated binaries elsewhere.)
Upvotes: 2