Ignoring files in git that don’t have an extension

Asked

Viewed 292 times

3

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

file. the

filing cabinet

the latter, in this system, is the binary executable generated by cpp.

If I wanted to ignore the files:

#.gitignore

*.o

# ... outros arquivos desnecessarios, alem do cpp

How can I do to ignore files without extension?

1 answer

3

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

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

But I don’t recommend doing this. Default use is to create a subdirectory build, for example, add this directory to the gitignore and create the executables there. Probably in the future you will want to create files without extension like Makefile MANUAL or something like that.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.