NetBeans 8.2 和 Git:如何从忽略文件或目录中排除。默认忽略供应商目录
NetBeans 8.2 and Git: How to exclude from ignore files or directories. Vendor directory ignored by default
我有 Netbeans 8.2,如您所见,我的项目中有两个文件被正确忽略,这些文件是“.gitkeep”和 "app.properties"。但是我想从忽略 /vendor/Demo/librery/File 目录下的所有文件中排除,但我必须做一些错误的事情,因为我看不到它们的变化。
.gitignore 文件:
.vagrant/
vendor/*
vendor/bin/*
vendor/composer/*
vendor/container-interop/*
vendor/psr/*
vendor/zendframework/*
vendor/zfcampus/*
!vendor/Demo/*
config/development.config.php
data/cache/*
data/logs/*
!data/cache/.gitkeep
phpunit.xml
ubuntu-xenial-16.04-cloudimg-console.log
我做错了什么?
编辑 1:
我对我的 .gitignore 文件进行了一些更改,但它不起作用。
.gitignore 文件:
.vagrant/
vendor/bin/*
vendor/composer/*
vendor/container-interop/*
vendor/psr/*
vendor/zendframework/*
vendor/zfcampus/*
!vendor/Demo/*
config/development.config.php
data/cache/*
data/logs/*
!data/cache/.gitkeep
phpunit.xml
ubuntu-xenial-16.04-cloudimg-console.log
编辑 2:
更多的变化,它不起作用。
.vagrant/
!vendor/
vendor/bin/*
vendor/composer/*
vendor/container-interop/*
vendor/psr/*
vendor/zendframework/*
vendor/zfcampus/*
!vendor/Demo/*
config/development.config.php
data/cache/*
data/logs/*
!data/cache/.gitkeep
phpunit.xml
ubuntu-xenial-16.04-cloudimg-console.log
编辑 3:
为什么供应商被忽略了?
.vagrant/
#!vendor/
#vendor/bin/*
#vendor/composer/*
#vendor/container-interop/*
#vendor/psr/*
#vendor/zendframework/*
#vendor/zfcampus/*
#!vendor/Demo/*
config/development.config.php
data/cache/*
data/logs/*
!data/cache/.gitkeep
phpunit.xml
ubuntu-xenial-16.04-cloudimg-console.log
已修复!!!
给我的所有解决方案都是正确的。 NetBeans 的问题是您必须关闭 NetBeans,清理 NetBeans 的缓存文件夹,最后再次打开 NetBeans 以查看之前在 .gitignore 文件中所做的更改。
But I want to exclude from ignore all the files that are under /vendor/Demo/library/File
directory,
Fist 忽略供应商内容,而不是供应商本身(文件夹)。
那是因为:It is not possible to re-include a file if a parent directory of that file is excluded.
/vendor/*
此处不需要所有其他 vendor/xxx
规则。
然后排除该忽略规则的文件夹:
!/vendor/**/
最后,排除你想要的文件:
!/vendor/Demo/library/File/**
你应该在此处关闭 "Ignore vendor
folder from versioning"
和"Permanently ignore non-sharable"这里
我有 Netbeans 8.2,如您所见,我的项目中有两个文件被正确忽略,这些文件是“.gitkeep”和 "app.properties"。但是我想从忽略 /vendor/Demo/librery/File 目录下的所有文件中排除,但我必须做一些错误的事情,因为我看不到它们的变化。
.gitignore 文件:
.vagrant/
vendor/*
vendor/bin/*
vendor/composer/*
vendor/container-interop/*
vendor/psr/*
vendor/zendframework/*
vendor/zfcampus/*
!vendor/Demo/*
config/development.config.php
data/cache/*
data/logs/*
!data/cache/.gitkeep
phpunit.xml
ubuntu-xenial-16.04-cloudimg-console.log
我做错了什么?
编辑 1:
我对我的 .gitignore 文件进行了一些更改,但它不起作用。
.gitignore 文件:
.vagrant/
vendor/bin/*
vendor/composer/*
vendor/container-interop/*
vendor/psr/*
vendor/zendframework/*
vendor/zfcampus/*
!vendor/Demo/*
config/development.config.php
data/cache/*
data/logs/*
!data/cache/.gitkeep
phpunit.xml
ubuntu-xenial-16.04-cloudimg-console.log
编辑 2:
更多的变化,它不起作用。
.vagrant/
!vendor/
vendor/bin/*
vendor/composer/*
vendor/container-interop/*
vendor/psr/*
vendor/zendframework/*
vendor/zfcampus/*
!vendor/Demo/*
config/development.config.php
data/cache/*
data/logs/*
!data/cache/.gitkeep
phpunit.xml
ubuntu-xenial-16.04-cloudimg-console.log
编辑 3:
为什么供应商被忽略了?
.vagrant/
#!vendor/
#vendor/bin/*
#vendor/composer/*
#vendor/container-interop/*
#vendor/psr/*
#vendor/zendframework/*
#vendor/zfcampus/*
#!vendor/Demo/*
config/development.config.php
data/cache/*
data/logs/*
!data/cache/.gitkeep
phpunit.xml
ubuntu-xenial-16.04-cloudimg-console.log
已修复!!!
给我的所有解决方案都是正确的。 NetBeans 的问题是您必须关闭 NetBeans,清理 NetBeans 的缓存文件夹,最后再次打开 NetBeans 以查看之前在 .gitignore 文件中所做的更改。
But I want to exclude from ignore all the files that are under
/vendor/Demo/library/File
directory,
Fist 忽略供应商内容,而不是供应商本身(文件夹)。
那是因为:It is not possible to re-include a file if a parent directory of that file is excluded.
/vendor/*
此处不需要所有其他 vendor/xxx
规则。
然后排除该忽略规则的文件夹:
!/vendor/**/
最后,排除你想要的文件:
!/vendor/Demo/library/File/**
你应该在此处关闭 "Ignore vendor
folder from versioning"
和"Permanently ignore non-sharable"这里