Pages

Wednesday, January 20, 2016

How to Fetch All Branch from a Repository?

Well Again !! The problem this blog solves is related to git.

The question is, how to fetch all remote branches at git? Well I found a simple answer to it on Stackoverflow

That is 

cd repo
In this Step, we are changing our directory where we want to clone our project (First needs to be created)

git clone --bare http://github.com/path/to/repo.git ./.git
This clones (bare) repository (only .git directory) to your local

git config unset core.bare
This step unset the variable bare and gives you regular/normal repository


and I think thats it, you can now select your branches using git branch {branch name}

Note: At this point you have a complete copy of the remote repo with all of it's branches (verify with git branch). You can use --mirror instead of --bare if your remote repo has remotes of its own.

No comments:

Post a Comment