Git clone 如何克隆指定分支代码

3 min read

如果你想要克隆指定分支的代码,则需要使用以下命令:

git clone -b <分支名> <git仓库url>

其中,-b 参数代表 branch,即分支名。<分支名> 指定需要克隆的分支名。<git仓库url> 指定需要克隆的 git 仓库的 URL。

例如,要克隆名为 develop 的分支,使用以下命令:

git clone -b develop https://github.com/your-username/your-repository.git

这将克隆 https://github.com/your-username/your-repository.git 仓库的 develop 分支代码到当前目录中。