如何通过github将最新的稳定分支克隆到dir?

Dan*_*yle 7 git installation github

我希望能够通过Git/github将最新稳定版本的WorPress一步克隆到dir中.现在,它很容易变得不稳定:

git clone git://github.com/WordPress/WordPress.git
Run Code Online (Sandbox Code Playgroud)

但这相当于获得编号最高的分支?

小智 8

从git克隆并更改为WordPress目录

git clone git://github.com/WordPress/WordPress.git 
cd WordPress
Run Code Online (Sandbox Code Playgroud)

然后列出分支..

git branch -r 
Run Code Online (Sandbox Code Playgroud)

这给了......

origin/1.5-branch   
origin/2.0-branch   
...
origin/3.4-branch  
origin/HEAD -> origin/master   
origin/master
Run Code Online (Sandbox Code Playgroud)

看看你想要的分店......

git checkout 3.4-branch
Branch 3.4-branch set up to track remote branch 3.4-branch from origin.
Switched to a new branch '3.4-branch'
Run Code Online (Sandbox Code Playgroud)


Dan*_*yle 4

这是我最终所做的,它包含在我在 Github 上的 Fabric fabfile中:

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

它像平常一样克隆存储库,然后执行一些 shell 魔法来查找 WordPress 的最新标记版本(这是稳定分支所在的位置。)