# how to clone all branches include remote branches

2 messages from 2009-02-10 to 2009-02-10. Participants: gnu kevin, Johannes Gilger.
Thread: https://gitlist.dev/t/17705

## gnu kevin, 2009-02-10 17:49

Subject: how to clone all branches include remote branches
Message-ID: <95463c700902100949w23a95536re9a65a2e5c3c0b5d@mail.gmail.com>
URL: https://gitlist.dev/e/95463c700902100949w23a95536re9a65a2e5c3c0b5d%40mail.gmail.com

```
hi,

I'd like to know how to get all remote(grandparent) branches by clone
a remote repo . for example:
remote repo ABC contains below branches:
master
stable/main
dev/main

while master is the local branch in remote repo and stable/main &
dev/main is two remote branches of that remote repo, when I clone from
ABC repo, I can only get a copy of ABC's local branch master, how can
I get those two remote(grandparent) branches also copied?

BRs,
Kevin

```

## Johannes Gilger, 2009-02-10 18:05

Subject: Re: how to clone all branches include remote branches
Message-ID: <gmsflm$sd4$1@ger.gmane.org>
URL: https://gitlist.dev/e/gmsflm%24sd4%241%40ger.gmane.org
In-Reply-To: <95463c700902100949w23a95536re9a65a2e5c3c0b5d@mail.gmail.com>

```
On 2009-02-10, gnu kevin <kevin.gnu.zhang@gmail.com> wrote:
> I'd like to know how to get all remote(grandparent) branches by clone
> a remote repo . for example:
> remote repo ABC contains below branches:
> master
> stable/main
> dev/main

You could (if your .git/config) already contains the remote simply add a 
line:
fetch = +refs/remotes/*:refs/remotes/<remote-name>/remotes/*

The double remotes is used so that no remote-remote-branch can overwrite 
your tracking branch with the same name.

Hope that helped,
Jojo

-- 
Johannes Gilger <heipei@hackvalue.de>
http://hackvalue.de/heipei/
GPG-Key: 0x42F6DE81
GPG-Fingerprint: BB49 F967 775E BB52 3A81  882C 58EE B178 42F6 DE81

```
