José Carlos
José Carlos

Reputation: 2932

NetBeans 8.2 and Git: How to exclude from ignore files or directories. Vendor directory ignored by default

I have Netbeans 8.2 and as you can see I have two files ignored correctly in my project, these files are ".gitkeep" and "app.properties". But I want to exclude from ignore all the files that are under /vendor/Demo/librery/File directory, but I have to do something wront because I don't see their changes.

enter image description here

.gitignore file:

.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

What am I doing wrong?

Edit 1:

I have made some changes in my .gitignore file and it doesn't work.

.gitignore file:

.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

Edit 2:

More changes and it doesn't work.

.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

Edit 3:

Why vendor is ignored?

.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

enter image description here

Fixed it!!!

All the solutions given to me are right. The problem with NetBeans is that you have to close NetBeans, clean the cache folder of NetBeans and finally, open again NetBeans to see the changes previously made them in .gitignore file.

Upvotes: 1

Views: 2314

Answers (2)

webmak10
webmak10

Reputation: 519

you should turn off "Ignore vendor folder from versioning" here

enter image description here

and "Permanently ignore non-sharable" here

enter image description here

Upvotes: 2

VonC
VonC

Reputation: 1330102

But I want to exclude from ignore all the files that are under /vendor/Demo/library/File directory,

Fist ignore vendor content, not vendor itself (the folder).
That is because: It is not possible to re-include a file if a parent directory of that file is excluded.

/vendor/*

No need for all the other vendor/xxx rules here.

Then exclude the folders for that ignore rule:

!/vendor/**/

Finally, exclude the files you want:

!/vendor/Demo/library/File/**

Upvotes: 2

Related Questions