When git clone some repository then it retrieves all branches from it:
git clone https://github.com/android/platform_build.git build1
cd build1/ && git branch -a && cd ..
then, when I use build1
as a mirror and clone it, I do not see all its remote branches (I see only build1
's local master branch)
git clone build1 build2
cd build2 && git branch -a && cd ..
How can I checkout remote of remote branches ?
I know that I can checkout all remote branches in build1 mirror with command
cd build1 && for remote in `git branch -r `; do git branch --track $remote; done
Track all remote git branches as local branches but what if I do not have access to build1 directory ?
Also, there is git ls-remote origin
command which shows all remote refs, but is there any elegant way to checkout those remote of remote branches ?