python - 如何克隆Python、Colab中的特定分支?

标签 python git github jupyter-notebook google-colaboratory

我通常使用它在 colab 中克隆 github 存储库

!git 克隆 https://github.com/user/repo.git

但假设我想克隆存储库的特定分支。我试过了

!git 克隆 https://github.com/user/repo/tree/branch.git

但我收到错误

致命:存储库'https://github.com/user/repo/tree/branch.git/ ' 未找到

最佳答案

试试这个:

!git clone -b branch_name https://github.com/user/repo.git

将branch_name替换为您要克隆的分支的名称

关于python - 如何克隆Python、Colab中的特定分支?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57130210/

相关文章:

python - 如何在圆柱面上生成规则点

git - 如何在 intellij 中断开项目的 git 连接?

git - Repo (+git) 的增值是什么?

php - 我可以在没有 ssh 访问权限的情况下在 PHP 中使用 shell_exec 或反引号吗?

github - 删除 GitHub 自托管运行器上的默认标签

python - 如何将 xampp 中的 MYSql 用于 python 3?

python - PyBrain 中 trainer.train() 的错误输出指的是什么?

python - 如何在 Python 中正确使用 coverage.py?

git - ubuntu git init 权限被拒绝

javascript - 使用 Github API 获取版本的所有提交部分