Creating tracked branches

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

 



On Thu, Apr 22, 2010 at 01:16:10AM -0700, Junio C Hamano wrote:
> Petr Baudis <pasky@xxxxxxx> writes:
> 
> > On Wed, Apr 21, 2010 at 07:57:17PM -0400, Aghiles wrote:
> >> On Wed, Apr 21, 2010, Randal L. Schwartz  wrote:
> >> >    git checkout -b test origin/test
> > ...
> > So, do I understand it right that there is still no canonical syntax to
> > check out local branch tracking a remote one of the same name, without
> > spelling out the branch name twice?
> 
> Only if you don't count Dscho's DWIM.
> 
>     $ git checkout tr/word-diff
>     Branch tr/word-diff set up to track remote branch tr/word-diff from origin.
>     Switched to a new branch 'tr/word-diff'

Ugh. Right, so _this_ is what kept me from ever learning the proper way:

  (i) If you do `checkout B`, it will track remote branch B if it exists.

  (ii) If you do `checkout -b B`, it will never auto-track anything.

  (iii) If you do `git checkout -t -b B`, it will auto-track your current
_local_ branch.

This keeps getting me really confused, I hope I will remember it now for
good, but I have seen others having trouble with this as well. I don't
have immediate ideas that would do less harm than good to fix this up...

perhaps except changing (iii) to auto-track the remote branch B if it
exists and require tracked branch name if it doesn't - the current
default seems pretty much useless to me for usual cases. (I can imagine
a scenario where it would be useful, but not a common scenario where
this would be useful default.)

P.S.: The "--track without -b implies branch creation" sentence in
git-checkout(1) seems to be plain wrong?

-- 
				Petr "Pasky" Baudis
http://pasky.or.cz/ | "Ars longa, vita brevis." -- Hippocrates
--
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]