How to clone the latest stable branch to a dir via github?

git, github, installation, wordpress

Solution

Here's what I actually ended up doing, which is included in 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.)

Problem

I want to clone the latest stable version of WordPress 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 manually checking out the code. E.g., using deployment shell script or deployment tool such as Fabric. Edit: I clarified the text to better indicate the intent that I meant how to do this from a script, not manually.

Original source