Blog & Stuff

Versions and Branching a Library

At work Andrew Cavanagh and I had to, using many examples on of libraries we use, to finalize how to branch and version our libraries.

There should be one branch for each major version (1.0, 2.0, etc).

These should be the only branches besides master.

Releases within these versions should be tagged following semantic versioning guidlines (v1.2.3 for example).

In general, all work should be done via pr from the master branch and then merged into whatever the current branch is.

The only exception is when you are making minor or patch version changes to a previous version.

For example, if the most current version is 2.0, then any changes to master via pr and then merged in to the 2.0 branch. However, at that point any changes required by the 1.0 branch would be made via pr off of the 1.0 branch. See fig.1 for an example.

figure 1

When creating a new version, the package's composer.json should alias dev-master to the latest version: