git克隆特定分支git clone
Git仓库中 克隆指定分支,命令
1 | git clone -b <分支名> --single-branch <仓库地址> |
示例
1 | git clone -b dev --single-branch https://github.com/user/repo.git |
这会克隆 dev 分支,而不是默认的 main 或 master 分支。
参数解释:
-b <branch>:指定要克隆的分支。--single-branch:只克隆指定的分支,节省空间(可选)。
如果你想要包括所有分支而不是单一分支,可以省略
--single-branch,如下:
1 | git clone -b dev https://github.com/user/repo.git |