使用composer create-project拉最新提交 [英] Pull latest commit with composer create-project
问题描述
我想使用 composer create-project
总是提取我正在使用的开发版本的最新提交。我注意到存在一个类似的问题,但是很遗憾,它没有帮助。
I'd like to use composer create-project
to always pull the latest commit of the dev version I'm using. I've noticed a similar question exists but unfortunately it didn't help.
当前我可以做(例如,对于Drupal) composer create-project drupal / drupal测试8.4。* @ dev
但这会拉动每晚的开发工作。相反,我希望能够指定我希望从中提取的提交哈希,因此理想情况下是追逐HEAD。另外,如果可能的话,我也希望使用单线执行此操作,而不必诉诸composer.json文件。
Currently I can do (e.g. for Drupal) composer create-project drupal/drupal test 8.4.*@dev
but this will pull the nightly dev build. Instead, I'd like to be able to specify the commit hash I wish to pull from and thus ideally chase HEAD. Also, I'd like to do this with a one-liner if at all possible, without having to resort to a composer.json file.
推荐答案
相反,我希望能够指定我希望从中提取的提交哈希,从而理想地追逐HEAD。
Instead, I'd like to be able to specify the commit hash I wish to pull from and thus ideally chase HEAD.
嗯,有一种语法可以指定git commit哈希: dev-master#hash
或 branch#哈希
。但是Composer团队并未真正支持此功能。它可能无法在 create-project
命令中正常工作。
引用: https://getcomposer.org/doc/04- schema.md#package-links
Well, there is a syntax to specify a git commit hash: dev-master#hash
or branch#hash
. But this feature is not really supported by the Composer team. It might not work as expected on the create-project
command.
Referencing: https://getcomposer.org/doc/04-schema.md#package-links
如果要理想地追逐HEAD,可以尝试在 create-project
(您可以提供一个版本作为第三个参数,否则使用最新版本。)。引用: https://getcomposer.org/doc/03-cli.md#创建项目
If you want to "ideally chase HEAD", you can try to leave the third parameter on create-project
away (You can provide a version as third argument, otherwise the latest version is used.). Referencing: https://getcomposer.org/doc/03-cli.md#create-project
也许一个替代方案可以提供帮助:
Maybe an alternative one-liner can help:
composer需要供应商/项目:dev-master#hash&&作曲家安装
这篇关于使用composer create-project拉最新提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!