Unignore subdirectories of ignored directories in Git

前端 未结 5 516
情书的邮戳
情书的邮戳 2020-12-04 18:27

Let\'s say I have ignored a directory, but I want to unignore specific subdirectories therein. So I have the setup:

/uploads/
/uploads/rubbish/
/uploads/rubb         


        
5条回答
  •  日久生厌
    2020-12-04 19:20

    Was trying to figure out how to include a specific folder when excluding all folders with the generic exclusion

    **/build
    

    if you add the /* to the end of your generic exclude you continue to exclude all build files **/build/*

    Then you add another line to correct for the path that you want to be included to look like

    !**/folder/build/* 
    

    leaving us a gitignore that reads

    **/build/* 
    !**/folder/build/* 
    

提交回复
热议问题