Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add existing remote branch to my locally cloned repository?

I would like to add this branch to my local clone: https://github.com/dmitriz/mithril.js/tree/rewrite

For some unclear reason, it did not get cloned.

So I ended up with local directory without that branch. Is there any easy way to clone this branch too?

like image 543
Dmitri Zaitsev Avatar asked Nov 15 '25 13:11

Dmitri Zaitsev


1 Answers

All you have to do is checking out to this branch.

$ git checkout rewrite

Git will switch to a new branch, tracking the remote one. Here is the message you should get

Branch rewrite set up to track remote branch rewrite from origin.
Switched to a new branch 'rewrite'
like image 188
Richard-Degenne Avatar answered Nov 17 '25 08:11

Richard-Degenne



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!