I have cloned a GitHub repository in Google Colab using !git clone ... but now I want to switch to another branch I have been working on. Seems like GitHub doesn't provide a unique clone link for different branches and colab doesn't allow !git checkout ... commands. Is there any way I can change branches in colab?
Yes, for example:
!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'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With