[英]Ignore everything but specific directories using .gitignore
I need to ignore every under /src
directory but not /src/BankBundle
. 我需要忽略/src
目录下的每个目录,而不是/src/BankBundle
。 For that in my .gitignore
file I do this: 为此,我在.gitignore
文件中这样做:
/vendor/*
/app/cache/*
/app/logs/*
/web/uploads/*
/web/bundles/*
/app/config/parameters*
.DS_Store
/src/BankBundle/Resources/public/example.html
composer.lock
/src/*
!/src/BankBundle
This isn't working because any changes I made outside /src/BankBundle
less say in /src/AnBundle
SmartGit recognizes as a change and then show me for COMMIT, what I'm doing wrong? 这是行不通的,因为我在/src/BankBundle
之外进行的任何更改/src/BankBundle
很少在/src/AnBundle
SmartGit识别为更改,然后向我显示COMMIT,我在做什么错了?
I have tried these three ignore paths in a local test repo: 我已经在本地测试仓库中尝试了以下三个忽略路径:
/src/BankBundle/Resources/public/example.html
/src/*
!/src/BankBundle
In /src/BankBundle
, there is a file hello.txt
. 在/src/BankBundle
,有一个文件hello.txt
。 When I run git add .
当我运行git add .
and git status
, the example.html
file is ignored, but hello.txt
is added. 和git status
, example.html
文件将被忽略,但会添加hello.txt
。
So it looks like your .gitignore
file is set up correctly. 因此,看来您的.gitignore
文件设置正确。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.