git except a sub directory and it's files of a ignored directory

后端 未结 3 768
粉色の甜心
粉色の甜心 2021-01-15 21:39

i use git to manage my sources,i have some file in bellow paths:

Debug/a.dll
Debug/b.exe
Debug/c.png
Debug/Pic/a.png
Debug/Pic/b.bmp
Debug/Pic/c.dll
<         


        
3条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-15 22:19

    You can add the subdirectory first, then ignore the containing directory:

    git add Debug/Pic
    git ignore Debug
    

    This will have the side effect of not showing the addition of new files to Debug/Pic, but you can just add them manually with 'git add -f' to get around the .gitignore warning.

提交回复
热议问题