Difference between ** and * in glob matching (.gitignore)

前端 未结 3 1395
Happy的楠姐
Happy的楠姐 2021-02-12 13:32

I have the following directory structure and files.

pw-spec/
|-- event_spec.coffee
|-- event_spec.js
|-- integration
|   `-- service
|       |-- auth_spec.coffee         


        
3条回答
  •  抹茶落季
    2021-02-12 14:05

    Create a .gitignore in pw-spec in which you insert these two lines:

    *.js
    */*.js
    

    Also note that if you already have files tracked in this subdirectory which you want "untracked", you have to make them unknown to the index as such:

    git rm --cached path/to/file
    

    For instance, if in directory pw-spec you can do:

    find -type f -name "*.js" | xargs git rm --cached
    

提交回复
热议问题