I am using git and PhpStorm for my project. When i trying to push, or pull, or to do any else action, i also see git repositories from /vendor (composer).
How to disable they for PhpStorm?
UPDATE:
/vendor already in .gitignore
# composer vendor dir
/vendor
In the root of your project just create/edit the .gitignore file and add the following
/vendor
You can do this for any directory you would like
if you want to include a sub-directory of a directory you exclude just add something like this.
!/vendor/bin
Here are the relevant git docs about it:
https://git-scm.com/docs/gitignore
Edit: I saw you did indeed have a correct .gitignore [assumption based on your reaction to the comment] If you have already worked with a file in phpstorm and added it to the ignore pattern later phpstorm does nothing with it, you should be manually removing the folder from your machine and from the repo [by deleting and commiting/pushing].
Just delete it and commit it to origin. and just use composer to reinstall. voila!
I find the solution! It was in File->Settings->Version Control. I Just unregister vendor roots. Thank all for help!
Do not know if very correctly applicable, but my search leading to this question was solved by applying "git reset" command on files I added prior adding them to a .gitignore file.
Related
I have a Symfony 3 project.
In the root dir is the usual vendor dir that composer uses for installation.
In the web dir I also have a vendor dir for bootstrap, fontawesome etc.
In .gitignore I have an entry vendor.
Unfortunately both vendor dirs are ignored. But I want to commit the web/vendor dir.
How is that possible?
May be I have found a solution. I added !web/vendor to the .gitignore.
Is this the right way?
gitignore will recursively ignore everything that matches the "vendor" pattern if that is all you have in your gitnore.
There are some basic rules about gitignore you should familiarize yourself with.
The one here is that gitignore will run relative to the directory it's in.
So, if you add a /vendor entry to the .gitignore in your root dir, then it will only ignore the vendor directory in your root dir. Leave out the slash, and it will drill down as far as it can go and ignore everything that has a vendor in the name, whether it be a file, directory, whatever.
A tip: try looking up sample .gitignore files on github for a specific project type you're using. These are usually good enough to get going.
For symfony, a good one is here: https://github.com/github/gitignore/blob/master/Symfony.gitignore
Yes, that was the right way. Just add !web/vendor.
We'd like to create a bundle which can deployed via composer/packagist for others to use. It'll wrap the logic created by the owners of MessageBird. Basically a kind of Service which will indeed be called with the container via ourvendor.messagebird.messaging.
Since it's a type of bundle (as per the docs of Sf3), we created a bundle while following the documentation:
http://symfony.com/doc/current/bundles/SensioGeneratorBundle/commands/generate_bundle.html
As the directory /src we used /vendor instead. That's when it all went wrong. Our namespace could not be located, loaded or even when we manually added it to the autoloading classes of Composer it failed all the same.
The question is, what is the best practice to go about this? We got it working right now and what we did was the following:
We created a bundle wit the following cmd:
bin/console generate:bundle --shared --namespace=OurVendor/MessageBird/MessageBirdBundle --bundle-name=MessageBirdBundle --format=yml
We moved the /src/OurVendor directory to /vendor/OurVendor as the only way to get a perfect generation was to use the default /src folder.
We manually updated the AppKernel.php
We did some debugging with namespaces for Composer but eventually we added "OurVendor\\":"vendor/" to the "autoload/psr-4" directive in root composer.json
We ran composer dumpautoload && bin/console cache:clear -e dev which resulted in an error.
We ran composer -o update which checked all dependencies and updated accordingly, including autogenerated autoload files
Strangely enough we had to add the Bundle to the AppKernel.php class and cleaned the cache again.
After all this it worked but the documentation said no such thing about developing a 3rd party vendor bundle.
http://symfony.com/doc/current/bundles/best_practices.html
So long story short, did we go about it the wrong way or what?
/vendor directory is managed by composer. Do not copy/move anything there. Don't even edit anything there, unless you understand all consequences.
When you create a shared bundle, you need to push it to a VCS of your choice, and add it as a dependency in composer.json of the project which uses it.
When you run composer update it will check-out your bundle into /vendor directory and generate correct autoload file.
Please read more how to use private repositories with composer.
When I switch between branches in PHPstorm I constantly get the following message:
Project components were changed externally and can not be
reloaded: ChangeListManager ToolWindowManager editorHistoryManager
FileEditorManager"
Would you like to reload the project?
How to avoid this error?
Thank you for your comments.
The solution was the following:
Delete .git
Add .idea to .gitignore
Then git -init
What rules should i add to .gitignore to ignore all error_log.txt files generated in php?
I have tried adding simply error_log to it, but it doesn't seem to work.
Im working on a Win7 x64 and i am new to Git.
To ignore a file (like error_log.txt) in all directories of your repository, you should add the following rule to the .gitignore in the root folder of your repo:
error_log.txt
As said, that will ignore all files called error_log.txt in all directories and subdirectories of the repo.
Be aware, that .gitignore does only ignore files that are not tracked yet. If you have added and commited a error_log.txt already, that file will stay tracked. See Ignore files that have already been committed to a Git repository for futher detail on that.
I have installed composer from this link, but I still could not find where do I need to place the composer.json file.
In the root of your project. Because you mentioned symfony, just have a look at the composer.json from the symfony-standard edition
https://github.com/symfony/symfony-standard/
Or even better: Follow the official instructions and use symfony-standard as starting point for your project directly.
Start by visiting the Symfony2 download page at http://symfony.com/download. On this page, you'll see the Symfony Standard Edition, which is the main Symfony2 distribution.
You can forkt it directly from github.
I just found on other topic that you can use :
php composer.phar --working-dir=/home/user/folder/ update
You may need to create a file called 'composer.json'
See this document "https://getcomposer.org/doc/00-intro.md#declaring-dependencies"
You could create a composer.json file by using the composer init command whilst in the directory you want it to be created in
composer init
or
path/to/composer.phar init