4

With the syntax in my composer.json of "vendor/xyz-bundle": "~2.1.0@dev" I'm trying to get the latest commit in the 2.0 branch, but it always checks out the tag 2.1.0, instead of progressing to the latest commit in the 2.0 branch.

This is what is looks like:

enter image description here

I've tried all kinds of stuff with branch-aliasing in the xyz-bundle, but it will never get the last commit of 2.0.

Does it have to do with the fact that there is no specifi 2.1 branch, and only a 2.0 branch? How can I check out the last commit in the 2.0 branch?

kkuilla
  • 2,226
  • 3
  • 34
  • 37
Flat
  • 43
  • 3

1 Answers1

5

~2.1.0 (flags are unimportant for now) means >=2.1.0,<2.2.0. You expect 2.0.x, this is not in the version range.

~2.0 means >=2.0,<3.0. Your expected version (2.0.x) is in this range. However, Composer will always install the latest version in the range. So it'll take 2.1.x instead.

If you want the latest release in 2.0, you need 2.0.*@dev or ~2.0.0@dev (both meaning >=2.0.0,<2.1.0).

Tip: You can use this usefull online utility to test your version constraints (so you can find out exactly which version constraint should be used).

Wouter J
  • 41,455
  • 15
  • 107
  • 112
  • Could you clarify for me how composer knows the difference and when to take a branch over a bunch of tags? That's something that still confuses me. – SchizoDuckie Feb 10 '16 at 14:39