Info
Content

Moodle Git Branches and Tags


Moodle uses the convention of the branch name MOODLE_XX_STABLE for each stable release e.g. Moodle 3.7 is in the MOODLE_37_STABLE branch.

All minor version upgrades then go into this branch until the next stabel release and are tagged accordingly.

There's heaps more information about this over at Moodle Docs in Git for Developers.

As a shortcut you can use the following to see all the stable branches:

git ls-remote git://git.moodle.org/moodle.git | grep head

This returns a bunch of hashes and the refs/heads/{MOODLE_XX_STABLE} branches. You can guess these, so this is just to check what they are without having to clone the entire repository. Plus you’ll know when a new stable branch is available in the repository.

To clone a specific branch (e.g. say I only want Moodle 3.2), use this command in the relevant target directory (note the -t to include tags so you can go to specific tags like v3.2.2):

git clone -b MOODLE_32_STABLE git://git.moodle.org/moodle.git

To see all the tags:

git ls-remote -t git://git.moodle.org/moodle.git | grep -v \\^\{\}
The grep at the end grep -v \\^\{\} removes the tag with the ^{} at the end, which seems to come through otherwise e.g. you get both refs/tags/v3.7.1 and refs/tags/v3.7.1^{}

You can then just filter down to your required Moodle stable version with another grep e.g. for just v3.6.x tags:

git ls-remote -t git://git.moodle.org/moodle.git | grep -v \\^\{\} | grep v3\.6

One other handy thing is to use show origin to see what you are currently tracking to make sure you have all the latest branches from the Moodle Git (remote) repository and if any of your loca branches may be out of date with remote.

git remote show origin
* remote origin
  Fetch URL: git://git.moodle.org/moodle.git
  Push  URL: git://git.moodle.org/moodle.git
  HEAD branch: master
  Remote branches:
    MOODLE_13_STABLE tracked
    MOODLE_14_STABLE tracked
    MOODLE_15_STABLE tracked
    MOODLE_16_STABLE tracked
    MOODLE_17_STABLE tracked
    MOODLE_18_STABLE tracked
    MOODLE_19_STABLE tracked
    MOODLE_20_STABLE tracked
    MOODLE_21_STABLE tracked
    MOODLE_22_STABLE tracked
    MOODLE_23_STABLE tracked
    MOODLE_24_STABLE tracked
    MOODLE_25_STABLE tracked
    MOODLE_26_STABLE tracked
    MOODLE_27_STABLE tracked
    MOODLE_28_STABLE tracked
    MOODLE_29_STABLE tracked
    MOODLE_30_STABLE tracked
    MOODLE_31_STABLE tracked
    MOODLE_32_STABLE tracked
    MOODLE_33_STABLE tracked
    MOODLE_34_STABLE tracked
    MOODLE_35_STABLE tracked
    MOODLE_36_STABLE tracked
    MOODLE_37_STABLE tracked
    master           tracked
  Local branches configured for 'git pull':
    MOODLE_36_STABLE merges with remote MOODLE_36_STABLE
    master           merges with remote master
  Local refs configured for 'git push':
    MOODLE_36_STABLE pushes to MOODLE_36_STABLE (local out of date)
    master           pushes to master           (local out of date)
No Comments
Back to top