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 -
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 -
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 -
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 -
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 :) -
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 -
How about just git init .. set up remote tracking info in .git/config .. git fetch remote which should do what you want. Linus -
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
-
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 -
