如何强制作曲家重新安装库? [英] How to force composer to reinstall a library?

查看:46
本文介绍了如何强制作曲家重新安装库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ZF2骨架应用程序,它具有一个.gitignore,可以防止将外部库提交给git。在调试时,我喜欢去库的源代码中的各处更改内容,以了解它们的工作方式。如果这些是受版本控制的,那么将它们恢复到原始状态将非常容易。

I'm using the ZF2 skeleton app and it has a .gitignore that prevents external libraries from being commited to git. While debugging I like to go and change stuff here and there in the libraries' source to learn how things work. If these were version controlled it would be very easy to revert them back to their original state.

如何强制Composer重新安装特定的框架,以便获得

How can I force Composer to reinstall a particular framework so that I can get a fresh -unmodified- copy again?

PS:请不要建议删除.gitignore文件,因为它在那里是有原因的;这样可以防止我的第三方库进入应用程序的存储库。我总是可以在自动部署期间安装它们。

PS: Please don't suggest removing the .gitignore file since it's there for a reason; it prevents my third party libraries from getting into my app's repository. I can always install them during an automated deployment.

推荐答案

您可以使用-prefer-source 标志,供作曲家使用VCS信息检出外部软件包(如果有)。您可以简单地恢复到原始状态。另外,如果您发出 composer update 命令,编辑器将检测到您在本地所做的任何更改,并询问是否要放弃它们。

You can use the --prefer-source flag for composer to checkout external packages with the VCS information (if any available). You can simply revert to the original state. Also if you issue the composer update command composer will detect any changes you made locally and ask if you want to discard them.

您的.gitignore文件与您的根项目(ZF2框架)相关,并且阻止了供应商目录(您的第三方lib所在的目录)提交到您自己的VCS。忽略文件与您的供应商的git仓库无关。

Your .gitignore file is related to your root project (ZF2 skeleton) and it prevents the vendor dir (where your third party libs are) from committing to your own VCS. The ignore file is unrelated to the git repo's of your vendors.

这篇关于如何强制作曲家重新安装库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆