How to clone whole repository with all branches in git

Sometimes we need all the branches available in our local system. Lets see how can we clone a github repository with all the available branches.

Clone the whole repository as bare. It will copy all the branches.
$git clone –bare https://github.com/planetoftheweb/expressjs.git .git

Make the bare repository to a regular github repo.
$git config –bool core.bare false

Reset head pointer of git to last state.
$git reset –hard

All the branch will be available
$git branch

I have got this nice info fromĀ https://www.lynda.com/Express-js-tutorials/Building-Website-Node-js-Express-js/502310-2.html

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.