Ignoring files in git that do not have extension

3

Programming in C ++ for Linux, when compiling the code with g ++, three files are generated:

  

file.o

     

file

The last one, in this system, is the executable binary generated by cpp.

If I wanted to ignore the files:

#.gitignore

*.o

# ... outros arquivos desnecessarios, alem do cpp

How can I do to skip files without extension?

    
asked by anonymous 04.04.2018 / 05:30

1 answer

3

The trick is to skip everything and then delete the files you want

# ignore tudo
*
# exclua os subdiretórios
!/**/
# exclua os arquivos com extensão
!*.*

But I do not recommend doing this. The default use is to create a build subdirectory, for example, append this directory to gitignore and create the executables there. Probably in the future you will want to create files without extension like Makefile MANUAL or something of the sort.

    
04.04.2018 / 23:24