Reputation: 103
I want to be able to make Git ignore everything but certain types of extensions.
This is my current .gitignore
file:
# ignore everything
*
# but desired files
!*.vhd
!*.tcl
!*.py
!*.cpp
!*.c
!*.tex
!*.asm
!*.qpf
The problem is that now Git also ignores patterns like this some/directory/somefile.vhd
If I add !*/
now directories starting with dot are not ignored.
How can I prevent that from happening?
I also tried adding two asterisks but the result was the same.
Upvotes: 0
Views: 36
Reputation: 213837
If the directory is ignored, all files inside will be ignored too. You can exclude the directories with the following:
*
!*/
.*/
!*.vhd
!*.tcl
Etc. Including the directories this way just means that those directories will be checked for non-ignored files. Directories are not actually included in Git.
Upvotes: 1