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

后端 未结 3 769
粉色の甜心
粉色の甜心 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:07

    Git use the .gitignore to ignore or to track files in ignored paths.

    In your case you need to do add this to your .gitignore file in your project root directory. Create the file is it does not exist

    #List of files to ignore
    Debug/*
    
    #List of files to exclude from the ignored pattern above
    !Debug/Pic
    !Debug/Pic/*
    

    What is in content of this sample .gitignore

    Debug/* - This will ignore all the files under the Debug folder
    !Debug/Pic/* - The ! is a special character in this case telling git to exclude the given pattern from the ignored paths.

    In other words:
    We "told" git to ignore all the files under the Debug folder but to include all the files under the Debug/Pic/ folder.

提交回复
热议问题