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

Wordpress 如何通过github将最新的稳定分支克隆到dir?,wordpress,git,github,installation,Wordpress,Git,Github,Installation,我想通过一个shell脚本从Github克隆WordPress的最新稳定版本。获取不稳定的主分支很简单: git clone git://github.com/WordPress/WordPress.git 但是如何通过脚本获得编号最高的稳定版本,而不是手动签出代码呢。例如,使用部署shell脚本或部署工具(如Fabric) 编辑:我澄清了文本,以便更好地表明我的意思是如何从脚本而不是手动执行此操作。您可以尝试使用git签出主机吗?git branch-r将显示所有远程分支 git check

我想通过一个shell脚本从Github克隆WordPress的最新稳定版本。获取不稳定的主分支很简单:

git clone git://github.com/WordPress/WordPress.git
但是如何通过脚本获得编号最高的稳定版本,而不是手动签出代码呢。例如,使用部署shell脚本或部署工具(如Fabric)


编辑:我澄清了文本,以便更好地表明我的意思是如何从脚本而不是手动执行此操作。

您可以尝试使用
git签出主机吗?

git branch-r
将显示所有远程分支


git checkout--track/
将设置一个跟踪远程分支的本地分支,以便推送或获取新的更新。

从git克隆并更改到WordPress目录

git clone git://github.com/WordPress/WordPress.git 
cd WordPress
然后列出分支

git branch -r 
这给了我们一些类似于

origin/1.5-branch   
origin/2.0-branch   
...
origin/3.4-branch  
origin/HEAD -> origin/master   
origin/master
查看您想要的分支

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'

以下是我最终实际完成的工作,包括在:


它像普通一样克隆repo,然后执行一些shell魔术来查找最新的带标签的WordPress版本(稳定分支所在的位置)。

在git克隆之后,您可以使用此命令

git checkout stable

如果这个问题似乎是针对WordPress的,请不要投反对票,因为它是从WordPress.stackexchange.com迁移过来的,现在在上下文中没有什么意义。哪个版本在主分支中?
git checkout stable