[英]how to install the latest version in a branch with composer?
Say I'm trying to install a package that has a 1.0 branch and a master branch. 假设我正在尝试安装具有1.0分支和master分支的软件包。 The 1.0 branch has tags like 1.0.1, 1.0.2, etc.
1.0分支具有1.0.1、1.0.2等标签。
What I want to be able to do is to install the latest version in the branch. 我想要做的是在分支中安装最新版本。 I don't want to install a tagged release - I want to install the latest branch version.
我不想安装带标签的发行版-我想安装最新的分支版本。
Here's what I tried: 这是我尝试过的:
composer require package/package:1.0
composer require package/package:~1.0
Both of those got the most recent 1.0.* tag but not the latest in the 1.0 branch. 两者都获得了最新的1.0。*标记,但没有获得1.0分支中的最新标记。
Is what I'm trying to do even possible? 我要做什么甚至有可能吗?
For that matter what even is the difference between 1.0
and ~1.0
? 就此而言,
1.0
和~1.0
之间的差异到底是什么?
You can require dev-master
as the version name (or dev-branchName), and it will pull in the most recent commit from the specified branch. 您可以要求
dev-master
作为版本名称(或dev-branchName),它将从指定分支中提取最新提交。 For versioned branch names, use eg 2.0.x-dev
as the version name instead. 对于版本化的分支名称,请使用例如
2.0.x-dev
作为版本名称。
(More details are available on the Schema - package links section of the Composer documentation.) (有关更多详细信息,请参阅Composer文档的“ 架构-程序包链接”部分。)
The difference between 1.0
and ~1.0
is that 1.0
specifies a specific version number, and ~1.0
specifies that any version "compatible" (according to semantic versioning) with 1.0 is allowed. 1.0
和~1.0
之间的区别是1.0
指定了特定的版本号,而~1.0
指定了允许任何与~1.0
“兼容”(根据语义版本控制)的版本。 From the Composer documentation : 从Composer文档中 :
The ~ operator is best explained by example:
~1.2
is equivalent to>=1.2 <2.0.0
, while~1.2.3
is equivalent to>=1.2.3 <1.3.0
.通过示例可以更好地解释〜运算符:
~1.2
等于>=1.2 <2.0.0
,而~1.2.3
等于>=1.2.3 <1.3.0
。
There is also the similar ^ operator: ^1.2.3
is equivalent to >=1.2.3 <2.0.0
. 还有一个类似的^运算符:
^1.2.3
等于>=1.2.3 <2.0.0
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.