How to avoid composer discard changes message

纵然是瞬间 提交于 2019-11-30 04:32:18

Set composer config to discard changes (see: https://github.com/composer/composer/pull/1188):

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

both @lemats and @reza-sanaie's answers are incomplete as --no-interaction (-n) composer's option is required to have a real update without any question (see https://github.com/composer/composer/pull/1188#issuecomment-16011533).

So after

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

or after modifying composer.json

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

use

php composer.phar update -n

Alternative to @lemats solution you can modify the composer.json file with:

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

It's worth nothing for this option to kick in you have to be running in --no-interaction mode

php composer.json install --no-interaction

Although I agree with @Seldaek on you shouldn't be modifying these vendor files, but sometimes you are forced to monkey patch it :(

How about not modifying vendor files? If they get modified most likely it's because of some messed up git settings for the line endings. See https://help.github.com/articles/dealing-with-line-endings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!