几个月来一直困扰我的简单问题。
有时我会深入到 vendor 目录来修复一个错误(尤其是对于我们的内部库)。在将修复程序迁移并部署回源包后,我将在主项目中 composer update company/package
并被询问:
Discard changes [y,n,v,d,s,?]
我对 y
和 n
有很好的了解,但找不到关于 v
、d
、s
、?
做什么的文档?我总是点击y
,但也许我错过了一些有用的东西。
编辑:
添加了 d 选项(17 年 10 月)
?
?这可能会带来一个很好的帮助信息。
y
并且没有能力点击?
而无需再等待几分钟。我想如果我在挠头,其他人也是。
选择 ?
会显示详细信息:
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
您也可以查看源代码,相关部分为here。
如果您使用 --no-interaction
运行,您可以在 composer.json
文件中设置 discard-changes: true
,并且不会每次都提示您输入此选项。
或者,运行:
COMPOSER_DISCARD_CHANGES=true composer install --no-interaction
--no-interaction
的情况下启动COMPOSER_DISCARD_CHANGES=true composer install --no-interaction