threads / discuss / 20167

clone

Subject: clone

## tl;dr

4 messages between Jul 20, 2009 and Jul 21, 2009.

replies: 3people: 3as markdown or json

Roald de Vries· Jul 20, 2009, 14:33 UTC · lore
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· Jul 20, 2009, 15:24 UTC · re: Roald de Vries · lore

Re: clone

On Mon, Jul 20, 2009 at 04:33:51PM +0200, Roald de Vries wrote:
Show 5 quoted lines
> 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· Jul 21, 2009, 08:05 UTC · re: Roald de Vries · lore

Re: clone

Roald de Vries venit, vidit, dixit 20.07.2009 16:33:
Show 9 quoted lines
> 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· Jul 21, 2009, 09:56 UTC · re: Michael J Gruber · lore

Re: clone

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:
Show 18 quoted lines
> 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
>

← back to recent threads