-->

如何避免作曲家放弃更改消息(How to avoid composer discard change

2019-07-04 05:11发布

我通过作曲家更新的symfony verdors。 我总是做它用:

php composer.phar update

但最近作曲家的版本,更新之前,每个包显示如下消息:

  - Updating doctrine/data-fixtures dev-master (a95d783 => a28b6bd)
The package has modified files:
M .gitignore
M .gitmodules
M LICENSE
M README.md
M UPGRADE
M composer.json
M lib/Doctrine/Common/DataFixtures/AbstractFixture.php
M lib/Doctrine/Common/DataFixtures/DependentFixtureInterface.php
M lib/Doctrine/Common/DataFixtures/Event/Listener/MongoDBReferenceListener.php
M lib/Doctrine/Common/DataFixtures/Event/Listener/ORMReferenceListener.php

修改-10更多的文件,选择 “V” 来查看完整列表放弃更改[Y,N,V,S,?]?

如何避免这种情况?

Answer 1:

集作曲配置丢弃的变化(参见: https://github.com/composer/composer/pull/1188 ):

php composer.phar config --global discard-changes true


Answer 2:

既作为--no互动(-N)作曲的选择需要有一个真正的更新没有任何问题@lemats和@礼- sanaie的答案是不完整的(见https://github.com/composer/composer/pull/1188 #issuecomment-16011533 )。

因此,后

php composer.phar config --global discard-changes true

或修改后composer.json

"config": {
    "discard-changes": true
},  

使用

php composer.phar update -n


Answer 3:

替代@lemats解决方案,您可以修改composer.json文件有:

  "config": {
      "discard-changes": true
  },  

这是值得没什么此选项踢你有必须运行--no-interaction模式

php composer.json install --no-interaction

虽然我对你@Seldaek同意不应该修改这些厂商的文件,但有时你不得不猴子修补它:(



Answer 4:

如何在不修改供应商的文件吗? 如果他们得到经修改的最有可能是因为对行尾部分搞砸了git的设置。 见https://help.github.com/articles/dealing-with-line-endings



文章来源: How to avoid composer discard changes message