Re: [RFC] git clone add option to track all remote branches

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

 



Yubin Ruan <ablacktshirt@xxxxxxxxx> writes:

> I am writing to ask that whether or not you think will be appropriate to add
> an option to "git clone" so that whenever a repo is cloned, branches are
> created automatically to track corresponding remote branches. (or is there any
> equivelant option?)
>
> You can obviously do this by a bash command like this
>
>     git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
>
> but it will be better if we can have an option in "git clone".

I am not sure how it will be more useful than what you already have.
In short, you are getting "all of the remote branches" but with a
twist.  You get them "on demand".

With your hypothetical "clone" command that makes copies of each and
every remote branch to a local one, you can ask "git branch<Enter>"
to show all of them (i.e. "please list what is happening at the
central repository").  With the current system, you would instead
need to ask "git branch -r<Enter>", which may be a bit more to type.

Also when you want to look at or work on top of a remote branch, say
"frotz", you do not have to do "git checkout -b frotz origin/frotz"
to create one, as your hypothetical "clone" would have already
created it when you cloned.  But I think "git checkout frotz" in
such a situation would create a local "frotz" branch out of the
"origin/frotz" remote-tracking branch with the current system, so
I do not think your hypothetical "clone" is all that more useful.

And there certainly is a huge downside.

If you are really doing your own development, then you would have
some topic branches of your own, with forks of some (but most likely
not all, especiallyi when there are many branches at the upstream)
branches you got from the upstream, and "git branch --list" that
shows only your own and what you are interested in (i.e. those that
you actually bothered to "git checkout <branchname>") without
showing random other branches that exist at the remote but do not
interest you is a feature.  Your hypothetical "clone" that
indiscriminatedly forks all branches at remote locally will destroy
the usefulness of it.



[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]

  Powered by Linux