Unignore subdirectories of ignored directories in Git

前端 未结 5 511
情书的邮戳
情书的邮戳 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:25

    Even if you add something to .gitignore, you can force git to add it to the index

    git add --force uploads/rubbish/stuff/KEEP_ME/
    

    However, "KEEP_ME" seems to be a directory and git usually doesnt like empty folder, so you should can add a "placeholder"-holder file instead, if the folder is empty

    git add --force uploads/rubbish/stuff/KEEP_ME/.keep_me
    

提交回复
热议问题