I am using symfony 2.1 with composer and I'm trying to run composer update
However, I keep getting "has uncommitted changes" , I don't remember changing any of the files in the vendors dir and it comes up with almost every package!
I tried composer install to revert any changes, but it doesn't seem to have an effect. If I delete the lock file and try an install , I get error messages like "symfony 2.1 requires symfony 2.1 -> symfony 2.1 satisfiable". It just doesn't make sense.
If I delete the contents in vendors I get the same error messages and nothing installs.
Nothing I do seems to work. Is there a way to update with "force" regardless of "uncommitted changes"
You can use composer status -v
. Here's how you can detect a file change in vendor/
using this command, and how to fix it.
First, we verify that no package is modified:
➜ SymfonyApp git:(master) ✗ composer status
No local changes
Then, we change a vendor file
➜ SymfonyApp git:(master) ✗ echo "modification" >> vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php
We then ask composer to tell us about modified vendor files (note the -v option, to see the modified files)
➜ SymfonyApp git:(master) ✗ composer status -v
You have changes in the following dependencies:
/Users/adrienbrault/Developer/SymfonyApp/vendor/symfony/symfony:
M src/Symfony/Component/HttpKernel/Kernel.php
We then reset the vendor git repository to set the files back to their original state.
➜ SymfonyApp git:(master) ✗ cd /Users/adrienbrault/Developer/SymfonyApp/vendor/symfony/symfony
➜ symfony git checkout .
➜ symfony cd -
~/Developer/SymfonyApp
Finally, we check that the files are not seen as modified anymore by composer.
➜ SymfonyApp git:(master) ✗ composer status -v
No local changes
Update: composer should now help you to handle this
You can also set the discard-changes
to true
in the config parameter of your composer.json file, see https://getcomposer.org/doc/06-config.md#discard-changes .
{
"name": "test",
"description": "Demonstrating concepts",
...
"config": {
"process-timeout": 1800,
"discard-changes" : true
},
...
}
因为这影响了在一台服务器上共享依赖项的各种项目,因为例如供应商作者会要求我在提交错误并提交到他们的仓库之前测试快速更改,所以我运行它以将丢弃更改全局设置为true :
php composer.phar config -g discard-changes 1
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.