【问题标题】:How to switch between GitHub branches in Google Colab如何在 Google Colab 中的 GitHub 分支之间切换
【发布时间】:2020-03-07 23:54:45
【问题描述】:

我在 Google Colab 中使用 !git clone ... 克隆了一个 GitHub 存储库,但现在我想切换到我一直在研究的另一个分支。似乎 GitHub 没有为不同的分支提供唯一的克隆链接,而 colab 不允许 !git checkout ... 命令。有什么办法可以更改 colab 中的分支吗?

【问题讨论】:

    标签: git google-colaboratory


    【解决方案1】:

    是的,例如:

    !git clone https://github.com/googlecolab/colabtools.git
    !cd colabtools && git checkout incoming
    
    Cloning into 'colabtools'...
    remote: Enumerating objects: 125, done.
    remote: Counting objects: 100% (125/125), done.
    remote: Compressing objects: 100% (125/125), done.
    remote: Total 1580 (delta 58), reused 67 (delta 0), pack-reused 1455
    Receiving objects: 100% (1580/1580), 466.90 KiB | 861.00 KiB/s, done.
    Resolving deltas: 100% (887/887), done.
    Branch 'incoming' set up to track remote branch 'incoming' from 'origin'.
    Switched to a new branch 'incoming'
    

    【讨论】:

    • 啊哈!我没有做cd ... 部分。非常感谢您加入并迅速回答!
    猜你喜欢
    • 1970-01-01
    • 2020-07-25
    • 1970-01-01
    • 2020-10-17
    • 1970-01-01
    • 2013-06-24
    • 2013-03-21
    • 2012-05-01
    • 2010-11-10
    相关资源
    最近更新 更多