I only want to commit files which extension is .fmb
, .fmx
and .pll
, but I can't configure .gitignore
file to achieve this.
I've tried with the following:
!.fmb
!.fmx
!.pll
and also with:
!*.fmb
!*.fmx
!*.pll
but it doesn't work.
Try this in your gitignore file-
*
!*.fmb
!*.fmx
!*.pll
You will want to first ignore everything and then whitelist files.
The only rule to remember when dealing with gitignore
rules is:
It is not possible to re-include a file if a parent directory of that file is excluded (*
)
(*
: unless certain conditions are met in git 2.?+, see below)
Since '*
' would ignore folders as well, any file exclusion rule would not be working.
Try:
*
!*/
!*.fmb
!*.fmx
!*.pll
That will properly un-ignore the folders (!*/
), and allow the next exclusion rule to work on files.
Note that with git 2.9.x/2.10 (mid 2016?), it might be possible to re-include a file if a parent directory of that file is excluded if there is no wildcard in the path re-included.
Nguyễn Thái Ngọc Duy (pclouds
) is trying to add this feature:
However, since one of the condition to re-inclusion was:
The directory part in the re-include rules must be literal (i.e. no wildcards)
That would not have worked here anyway.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With