Q
Q
Quadro2014-08-24 13:53:08
PHP
Quadro, 2014-08-24 13:53:08

How to undo changed files in composer? (composer revert modified files )?

Greetings.
Can you please tell me if
it is possible to undo the changed files through composer or reinstall the libraries?
The situation is this: there is a lib/vendors directory and in it I changed some library files for debugging,
through "composer status -v"

D:\projects\github\yii_cms>composer status -v
You have changes in the following dependencies:
D:\projects\github\yii_cms\common\lib\vendor/zhuravljov/yii2-debug:
    M controllers/DefaultController.php
     M views/layouts/main.php

I see these changes and I want to sort of reinstall the entire lib. The "lib/vendors" folder is in my .gitignore, so I can't do a revert through git. The only way out is to manually delete the folder with either and do the update again?
"composer update" either with --prefer-source or --prefer-dist doesn't offer to discard files and does nothing. True, if, for example, the version of a lib has changed, then he says that such and such files have been changed and suggests "dicard", but if the version has not changed, then just a silent update goes on and the files remain untouched.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
silentvick, 2014-08-24
@silentvick

You can just clean up the entire vendor directory and install all packages again

S
Sergey, 2014-08-24
Protko @Fesor

A small correction - not update but install. The latter will install exactly the versions that you had (pl composer.lock).
If your composer installed dependencies with prefer-dist (that is, you downloaded the archive), then yes. Just remove the directory and run composer install.
If your composer cloned the package and did a checkout, you can manually make the directory checkout necessary, or composer will offer to do it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question