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.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.