Clone All Remote Branches With Git

The results I’ll be studying were pushed on 17th Dec. I had a lot of doubts, I cleared them on 18th and then I had to clone all the branches from here. I tried to clone, pull, and fetch, but it remained unable to get anything other than the master branch. This post is about how to clone it all.


To explain how to do it, let me take the repo that I worked on:


Clone it and cd into it

git clone

cd faults-in-Linux


Look at the local branches in the repo you cloned

git branch

* master


But there are some hidden branches too, find them using:

git branch -a

In the case of what we have cloned, you will get:

* master

remotes/origin/HEAD -> origin/master






To take a quick peek at an upstream branch, you can check it out directly:

git checkout origin/


To work on that branch, you’ll need to create a local tracking branch:

git checkout -b origin/

you will get

Branch set up to track remote branch from origin.
Switched to a new branch ''


Now look at your local branches and you will get

git branch






……and you are done. 🙂


2 thoughts on “Clone All Remote Branches With Git

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s