简体   繁体   中英

Cannot check out a branch using Composer

I'm trying to check out the doctrine/orm 2.6 branch on Composer, but for some reason this doesn't work:

$ composer require doctrine/orm:dev-2.6

[InvalidArgumentException]
Could not find package doctrine/orm in a version matching dev-2.6

Even though this is the approach suggested in Composer require branch name .

This works with the master branch ( dev-master) , but for some reason doesn't with the 2.6 branch. Why?

How to check out the 2.6 branch using Composer?

When branch names look like versions, we have to clarify for composer that we're trying to check out a branch and not a tag. In the above example, we have two version branches: v1 and v2. To get Composer to check out one of these branches, you must specify a version constraint that looks like this: v1.x-dev. The.x is an arbitrary string that Composer requires to tell it that we're talking about the v1 branch and not a v1 tag (alternatively, you can name the branch v1.x instead of v1). In the case of a branch with a version-like name (v1, in this case), you append -dev as a suffix, rather than using dev- as a prefix.

Therefore, you have to do the following:

composer require doctrine/orm:2.6.x-dev

You can read more from the documentation here: https://getcomposer.org/doc/articles/versions.md#branches

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM