git ignoring .gitattributes pattern

后端 未结 7 2091
夕颜
夕颜 2020-12-16 20:45

I\'ve a directory structure like this:

root/
  .git
  deploy/
  Site/
    blah/
    more_blah/
      something.local
      else.development
    Rakefile
             


        
7条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-16 21:39

    Not sure this is common case but I had trouble excluding folder tests from source tree which have many nested levels of folders. If I wrote only this line to .gitattributes

    tests/* export-ignore
    

    It didnt work and entire directory was remain in archive. The solution was to add wildcards for all subdirs levels:

    tests/* export-ignore
    tests/*/* export-ignore
    tests/*/*/* export-ignore
    tests/*/*/*/* export-ignore
    tests/*/*/*/*/* export-ignore
    

    With these lines the tests directory finally disappeared from archive.

提交回复
热议问题