Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can git be configured to ignore files?

Tags:

git

c

There are some files we want ignored, not tracked, by git, and we are having trouble figuring out how to do that.

We have some third-party C library which is unpacked and we have it in Git. But when you configure && make it, it produces many new files. How to write .gitignore to track source files and not the new stuff. (it's not like forbidding *.o)

Edit: There are at least 12 file-types. So we would like NOT to enumerate, which type we want and which not.

like image 773
Cartesius00 Avatar asked Jan 19 '23 04:01

Cartesius00


1 Answers

Use ! to include all the types of files you need. Something like in the following example"

*
!*.c
!*.h
like image 67
Igor Popov Avatar answered Jan 27 '23 07:01

Igor Popov