How to ignore all subfolders in a folder with .gitignore

前端 未结 2 1737
一个人的身影
一个人的身影 2021-02-13 15:14

I have a folder in Git with some files in it. Files are a part my Git repository. When running my project some work directories appear in this folder. Directories can have any n

相关标签:
2条回答
  • 2021-02-13 15:41

    It's quite simple. Create the .gitignore in the folder with:

    */*
    

    I.e. ignore all files which are in any folder of the current folder.

    0 讨论(0)
  • 2021-02-13 15:44

    Try this:

    !folder/
    folder/*
    

    The first line excludes the top level from being ignored, and the second line ignores all subfolders.

    0 讨论(0)
提交回复
热议问题