How to git ignore subfolders / subdirectories?

后端 未结 10 1166
孤街浪徒
孤街浪徒 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 01:03

    All the above answers are valid, but something that I don't think is mentioned is that once you add a file from that directory into the repo, you can't ignore that directory/subdirectory that contains that file (git will ignore that directive).

    To ignore already added files run

    $ git rm --cached
    

    Otherwise you'll have to remove all files from the repo's target directory first - and then you can ignore that folder.

提交回复
热议问题