Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

not sure why this isn't working, as I've done this loads! Maybe I'm having a bad day...

I'm using the following code to ignore all files except for certain filenames and extension

*
!.gitattributes
!.gitignore
!readme.md
!.gitkeep
!*.php

For some reason, its only allowing me to commit the .gitignore and readme.md, even though I have php files in subfolders etc. Is there anything wrong with it? Just fyi, I'm using "git add -A" to pick up the files to commit.

Thanks in advance!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.1k views
Welcome To Ask or Share your Answers For Others

1 Answer

The solution is to tell Git not to ignore sub directories:

*
!.gitattributes
!.gitignore
!readme.md
!.gitkeep
!*.php
!*/

Otherwise, only the *.php files in the first directory level will be accepted and all sub directories will be ignored.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...