# clone

4 messages from 2009-07-20 to 2009-07-21. Participants: Roald de Vries, Jeff King, Michael J Gruber.
Thread: https://gitlist.dev/t/20167

## Roald de Vries, 2009-07-20 14:33

Subject: clone
Message-ID: <D229D90E-0294-475D-B7AC-6C7B23CC169A@roalddevries.nl>
URL: https://gitlist.dev/e/D229D90E-0294-475D-B7AC-6C7B23CC169A%40roalddevries.nl

```
Dear all,

If I clone a repository with multiple branches to 'newdir', and then  
type 'git branch' in 'newdir', I see only 1 branch. 'git branch -r'  
gives me all branches. Is that correct behaviour? If so, why? And  
mainly: can I configure git to clone all original branches to non- 
remote branches?

Kind regards, Roald

```

## Jeff King, 2009-07-20 15:24

Subject: Re: clone
Message-ID: <20090720152407.GC5347@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20090720152407.GC5347%40coredump.intra.peff.net
In-Reply-To: <D229D90E-0294-475D-B7AC-6C7B23CC169A@roalddevries.nl>

```
On Mon, Jul 20, 2009 at 04:33:51PM +0200, Roald de Vries wrote:

> If I clone a repository with multiple branches to 'newdir', and then
> type 'git branch' in 'newdir', I see only 1 branch. 'git branch -r'
> gives me all branches. Is that correct behaviour? If so, why? And
> mainly: can I configure git to clone all original branches to non-
> remote branches?

Yes, it's correct. You really only need local branches of things you are
going to work on. And then that happens, you generally would just "git
checkout -b foo origin/foo" to make your own local "foo" branch that you
will be working on (or if you are using topic branches, something more
like "git checkout -b mytopic origin/master"). If you are just
inspecting branches (e.g., checking them out to try building, doing
diffs against them, using them as reference points for logging, etc),
then the remote versions are fine.

-Peff

```

## Michael J Gruber, 2009-07-21 08:05

Subject: Re: clone
Message-ID: <4A6576B3.7000503@drmicha.warpmail.net>
URL: https://gitlist.dev/e/4A6576B3.7000503%40drmicha.warpmail.net
In-Reply-To: <D229D90E-0294-475D-B7AC-6C7B23CC169A@roalddevries.nl>

```
Roald de Vries venit, vidit, dixit 20.07.2009 16:33:
> Dear all,
> 
> If I clone a repository with multiple branches to 'newdir', and then  
> type 'git branch' in 'newdir', I see only 1 branch. 'git branch -r'  
> gives me all branches. Is that correct behaviour? If so, why? And  
> mainly: can I configure git to clone all original branches to non- 
> remote branches?
> 
> Kind regards, Roald

A for the 2nd part (1st one answered by Jeff), you can "git clone --mirror".

But me suspects that you actually want (s)cp -rp, do you?

Michael

```

## Roald de Vries, 2009-07-21 09:56

Subject: Re: clone
Message-ID: <0884A878-A57C-4089-AE32-A3D1ACC32FED@roalddevries.nl>
URL: https://gitlist.dev/e/0884A878-A57C-4089-AE32-A3D1ACC32FED%40roalddevries.nl
In-Reply-To: <4A6576B3.7000503@drmicha.warpmail.net>

```
Hi Michael,

I actually meant cloning all branches to both remote and non-remote  
(but remote-tracking) branches. But still, the --mirrorring is  
usefull, thx.

Kind regards, Roald


On Jul 21, 2009, at 10:05 AM, Michael J Gruber wrote:
> Roald de Vries venit, vidit, dixit 20.07.2009 16:33:
>> Dear all,
>>
>> If I clone a repository with multiple branches to 'newdir', and then
>> type 'git branch' in 'newdir', I see only 1 branch. 'git branch -r'
>> gives me all branches. Is that correct behaviour? If so, why? And
>> mainly: can I configure git to clone all original branches to non-
>> remote branches?
>>
>> Kind regards, Roald
>
> A for the 2nd part (1st one answered by Jeff), you can "git clone -- 
> mirror".
>
> But me suspects that you actually want (s)cp -rp, do you?
>
> Michael
>

```
