6

I am using Composer "composer update" via a cronjob to daily update an instance of software and thus run on master. About once a month this fails because Composer returns the following prompt:

The package has modified files

M modifiedfile.php

Discard changes [y,n,v,s,?]?

So no update is performed. This is a bit annoying. Is there a way to force the update even with modified files? Documentation at Composer suggests that this is not possible though I cannot believe that it should not.

So I am trying my luck here: Is there something like "composer update --force" or some sort of trick around or am I looking at a lost cause?

kghbln
  • 173

2 Answers2

4

You can use --no-interaction for this.

https://getcomposer.org/doc/03-cli.md#composer-no-interaction

(old topic, but pops-up in Google without an answer)

Maarten
  • 56
0

--no-interaction answers N to this question - meaning that the composer install command fails.

There is no option which might answer Y or --force the install.

The only workaround seems to be rm -R /vendor/ before running composer install.

fisharebest
  • 101
  • 1