wordpressgitshellgithubfabric

How can I clone the latest stable branch to a directory via a script?


From GitHub via a shell script it is simple to get the unstable master branch:

git clone git://github.com/WordPress/WordPress.git

But how can I get the highest numbered stable release via a script, not by manually checking out the code, but using a deployment shell script or a deployment tool such as Fabric?


Solution

  • From a Fabric fabfile I have on GitHub:

    git clone git://github.com/WordPress/WordPress.git .
    git checkout $(git describe --tags $(git rev-list --tags --max-count=1))
    

    It clones the repo like normal, then does some shell magic to find the latest tagged version of WordPress (which is where the stable branches live).