How to .gitignore files recursively

前端 未结 4 1406
太阳男子
太阳男子 2020-12-12 23:17

I\'m trying to avoid the following pattern in my .gitignore file.

MyPrject/WebApp/Scripts/special/*.js
MyPrject/WebApp/Scripts/special/*/*.js
My         


        
4条回答
  •  猫巷女王i
    2020-12-12 23:53

    Following gitignore manual page:

    [...] git treats the pattern as a shell glob suitable for consumption by fnmatch(3) with the FNM_PATHNAME flag: wildcards in the pattern will not match a / in the pathname.

    So, this clearly stands that there is no way to specify a certain amount of directories between two strings, like between special and js.

    Nevertheless, you can have a .gitignore file per directory, so maybe in your case the following content

    *.js
    

    at the following place

    MyPrject/WebApp/Scripts/special/.gitignore
    

    would be sufficient?

提交回复
热议问题