156

Simple question that's been bugging me for months.

Occasionally I'll dive into the vendors directory to fix a bug (especially for our internal libs). After migrating and deploying the fix back to the source package, I'll composer update company/package in the main project and am asked:

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

I have a decent grasp on y and n but haven't been able to find documentation about what v, d, s, ? do? I always hit y but maybe I'm missing out on something useful.


Edits:

  • added d option (oct '17)
Mark Fox
  • 8,694
  • 9
  • 53
  • 75
  • 9
    Have you tried using `?`? This will probably bring up a nice help message. – nneonneo Sep 13 '14 at 22:00
  • 2
    Sure. Things is it takes about two minutes for composer to do the update, recognize the dirty state and when doing actually work muscle memory kicks in I hit `y` and have no ability to hit `?` without waiting another couple of minutes. I figure if I'm scratching my head others are too. – Mark Fox Sep 13 '14 at 22:12
  • this has got to be one of the misleading messages i've ever seen "updated, discard changes"? yes actually does not disccard changes and no actually does. wtf – user151496 Jun 23 '23 at 09:21

2 Answers2

234

Choosing ? shows you the details:

y - discard changes and apply the update
n - abort the update and let you manually clean things up
v - view modified files
d - view local modifications (diff)
s - stash changes and try to reapply them after the update

You can also check the source code, the relevant part is here.

Mark Fox
  • 8,694
  • 9
  • 53
  • 75
Gergo Erdosi
  • 40,904
  • 21
  • 118
  • 94
46

If you run with the --no-interaction, you can set discard-changes: true in composer.json file and you wont get prompted for this option every time.

Or, run:

COMPOSER_DISCARD_CHANGES=true composer install --no-interaction

Jon Winstanley
  • 23,010
  • 22
  • 73
  • 116
Reza S
  • 9,480
  • 3
  • 54
  • 84