This week we have modified the branching strategy that we have been using when maintaining the MODX Revolution repository at Github. The long familiar master and develop branch are gone, and in their place we have major and minor version branches that serve the same purposes for each major and the current stable minor releases of MODX Revolution. Since the current stable minor release of version 2 is 2.4.0, that means we have a 2.x (default) branch and a 2.4.x branch which replace—in terms of where to target Pull Requests—develop and master respectively for version 2. In the coming days, a 3.x development branch will appear as well.
Following are some tips for keeping up with the changes.
Updating Existing Clones
If you have a clone of the official repository, you can quickly fetch and checkout the latest branches.
To checkout the latest changes targeted for the next minor release, including new features, bug fixes and translation updates:
$ git fetch origin $ git checkout -b 2.x origin/2.x
To checkout just the latest bug fixes and translation updates for the current minor release, 2.4:
$ git fetch origin $ git checkout -b 2.4.x origin/2.4.x
To cleanup your clone and remove the old remote tracking branches that have been deleted from the repository:
$ git remote prune origin
Updating Existing Forks
If you have a clone of an existing fork with the main repository added as a remote named upstream, you can quickly update your fork and your clone with the latest branches by executing the following commands.
To checkout the latest changes targeted for the next minor release, including new features, bug fixes and translation updates:
$ git fetch upstream $ git checkout -b 2.x upstream/2.x
To checkout just the latest bug fixes and translation updates for the current minor release, 2.4:
$ git fetch upstream $ git checkout -b 2.4.x upstream/2.4.x
To cleanup your clone and remove the old remote tracking branches that have been deleted from the upstream repository:
$ git remote prune upstream
Publish new branches and tags to your fork, a.k.a. origin with:
$ git push origin 2.x 2.4.x --tags
You can remove the old branches from your fork via GitHub or by using a command like:
$ git push origin :master :develop :release-2.2
NOTE: That would remove the old master, develop, and release-2.2 branches from your fork; you could remove all branches except 2.x, 2.4.x and any outstanding pull request branches.
About Jay Gilmore
Jay Gilmore is General Manager at MODX, the company behind the open source MODX CMS and MODX Cloud hosting platform. He's been working with MODX since 2006 and was one of the first five employees when the company formed in 2010. He writes about the web and whatever else catches his attention at jaygilmore.ca.
Learn more about Jay Gilmore.