英文:
gitignore cannot exclude folders from exclusion
问题
I have troubles excluding a pattern from .gitignore (I want the folder to be added)
currently my .gitignore is like:
/*
!file1.conf
!file2.ini
!*.xml
!confs/*
in a hierarchy that have really many files
When I git add .
it correctly add xml
s present in the root directory along with file1.conf
and file2.ini
but no file from confs/
folder is added.
git status
returns:
file1.conf
file2.ini
data1.xml
logback.xml
but the expected confs/filea.json
is missing
英文:
I have troubles excluding a pattern from .gitignore (I want the folder to be added)
currently my .gitignore is like:
/*
!file1.conf
!file2.ini
!*.xml
!confs/*
in a hierarchy that have really many files
When I git add .
it correctly add xml
s present in the root directory along with file1.conf
and file2.ini
but no file from confs/
folder is added.
git status
returns:
file1.conf
file2.ini
data1.xml
logback.xml
but the expected confs/filea.json
is missing
答案1
得分: 2
你应该包括文件夹 和 文件夹内容,所以你需要同时包括 confs/
和 confs/*
:
*
!file1.conf
!file2.ini
!*.xml
!confs/
!confs/*
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论