Re: GIT vs Other: Need argument

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Mon, 23 Apr 2007, Carl Worth wrote:
>
> And with the recent talk about phasing cogito out and just merging its 
> functionality into git itself, why not just use the cogito syntax for 
> this:
> 
> 	git clone <url>#<branch>

That's a fundamentally weaker operation than the current "git clone", so I 
really don't think it's a good idea. The syntax also absolutely sucks, 
it's so horribly non-unixy.

I'd personally be ok with a

	git clone --default=<branch> <url>

to create something where "master" defaults to some other remote branch, 
but that just addresses the syntax. And quite frankly, I don't think we 
*need* to. We shoud just tell people how _easy_ it is to track some other 
branch now.

So I don't really see the problem with just saying:

 - the remote *has* a default branch. That's the one you get by default 
   with "git clone".

 - if you want to track another branch, you should just tell git that you 
   want to track it, and switch to that instead:

	git branch --track mybranch origin/otherbranch
	git checkout mybranch

   and be happy with it.

Yes, it's two extra commands, but they aren't *that* hard to explain, 
after all. You really can basically explain each stage both very simply 
and naturally with just

 - first you clone the repository. This gets you all remote branches, and 
   sets "master" to track the default remote branch.

	git clone remote [local-dir]

 - then, you create a new branch that you want to track another of the 
    branches in origin

	git branch --track mybranch origin/otherbranch

 - then you check that branch out

	git checkout mybranch

and notice how each stage really was not only pretty logical, but even the 
command to do it didn't really look *that* strange: even without the 
explanation of what the commands are doing, somebody reading just the pure 
commands could probably _guess_ what they do!

Really, all three stages are pretty simple, and they are not really that 
hard to explain. And it's not even like you do this very often - so this 
is the _perfect_ kind of thing to have on a "git reference card" kind of 
thing (think O'Reilly reference card series).

So I _really_ think that if we just had the "this is how to use 'git' as a 
replacement for 'anonymous CVS'-like usage" documentation, you could 
explain all of this very concisely, and with absolutely zero confusion 
even to a total non-git person. Give a few example command lines from real 
life (eg, tracking the "next" branch from git itself), and make it easy to 
find, and you're all done.

The advantage is that unlike that *idiotic* cogito syntax, you don't 
actually *lose* anything. If somebody says "but I'd like to track *two* 
branches", the sequence is _exactly_ the same. There is no "special magic" 
at clone time.

And the syntax is also much clearer. No magic and horribly non-unixy 
URL#branch syntax.

			Linus
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]