Re: [FEATURE REQUEST] git clone, just clone selected branches?

Previous thread: git stash clear by Eric Davis on Wednesday, October 10, 2007 - 9:42 am. (2 messages)

Next thread: Lots of loose objects by David Kågedal on Wednesday, October 10, 2007 - 12:13 pm. (2 messages)
From: Joakim Tjernlund
Date: Wednesday, October 10, 2007 - 11:55 am

To my knowlede a git clone always clones all branches from the remote repo.
I would like the possibly to clone selected branches, like
 git clone <repo URL> -b master -b upstream
which will only fetch the master and upstream branch.

I know I can use git remote to do this, but it is a bit clumsy 
when starting a new repo.

What do you think?

 Jocke

-

From: Johannes Schindelin
Date: Wednesday, October 10, 2007 - 12:35 pm

Hi,


This is why I suggest: since it is an itch of yours, just fix it.  You are 
in the prime position to know when you're satisfied.

As a hint how to start: Junio dreamt of a git-clone which is a tiny 
wrapper around git-fetch and git-remote.

So you could start by writing a script which would be a replacement for 
git-clone.sh, and there you can also include the support for -b that you 
would like so much.

It would be nice, though, to keep this in separate patches, which you then 
submit to this list.

Thank you,
Dscho

-

From: Joakim Tjernlund
Date: Wednesday, October 10, 2007 - 2:25 pm

Thank you for these words of visdom, I should know better
than to throw out ideas like this. Next time I have an suggestion
I will think long and hard about it before posting again. 

 Jocke 

-

From: Johannes Schindelin
Date: Wednesday, October 10, 2007 - 2:56 pm

Hi,


Hey, it was just a try.

Personally, I am not interested in the feature _you_ asked for, but I 
thought it might be pretty easy for you to rewrite git-clone.sh to take 
advantage of git-fetch and git-remote, and that your desired feature would 
be easier to add then.  So easy that the whole thing would have taken you 
all of an hour or so.

But maybe somebody else is interested enough to scratch your itch.

Ciao,
Dscho

-

From: Joakim Tjernlund
Date: Wednesday, October 10, 2007 - 3:41 pm

Well, now I had to take a look and I think you are overestimating my capabilities :)
It is a 12KB script full of git-plumbing I have never used, nor do I do
sh scripts well. It might be an hour for you, but I would probably have
to spend the whole day :)


-

From: Johannes Schindelin
Date: Wednesday, October 10, 2007 - 4:01 pm

Hi,


Heh.  git-clone is pretty crowded.  But it predates git-remote.  And I 
have a hunch that git-clone will be a trivial script when it calls 
git-remote and the git-fetch.

Ciao,
Dscho

-

From: Linus Torvalds
Date: Wednesday, October 10, 2007 - 12:38 pm

How about just

	git init
	.. set up remote tracking info in .git/config ..
	git fetch remote

which should do what you want.

		Linus
-

From: Joakim Tjernlund
Date: Wednesday, October 10, 2007 - 2:36 pm

From git remote man page:
 o  Imitate git clone but track only selected branches

          $ mkdir project.git
          $ cd project.git
          $ git init
          $ git remote add -f -t master -m master origin git://example.com/git.git/
          $ git merge origin

yes, this does the trick too but that is more to type so I thought
it would be simpler if I could just tell git clone which branches I want.
Now, this isn't a killer feature to me so if you don't like it, I good
with that too.

 Jocke

-

From: Andreas Ericsson
Date: Thursday, October 11, 2007 - 2:18 am

Well, that's how git-clone should probably look, now that git-remote exists.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
-

Previous thread: git stash clear by Eric Davis on Wednesday, October 10, 2007 - 9:42 am. (2 messages)

Next thread: Lots of loose objects by David Kågedal on Wednesday, October 10, 2007 - 12:13 pm. (2 messages)