How to git ignore subfolders / subdirectories?

后端 未结 10 1187
孤街浪徒
孤街浪徒 2020-11-28 00:30

I have a lot of projects in my .Net solution. I would like to exclude all \"bin/Debug\" and \"bin/Release\" folders (and their contents), but still include the \"bin\" folde

10条回答
  •  伪装坚强ぢ
    2020-11-28 00:44

    The generic way to ignore all subfolders, while continuing to track the files that are in the /bin directory would be to add the following line to your project's .gitignore file:

    bin/*/*
    

    If you want to ignore only particular named subfolders, you can do:

    bin/Debug/*
    bin/Release/*
    

    nb. if the bin directory is not in the root of your project (alongside the .gitignore file), then instead of eg. bin/*/* you might need path/to/bin/*/*

提交回复
热议问题