git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Baudis <pasky@suse.cz>
To: Junio C Hamano <gitster@pobox.com>
Cc: Aghiles <aghilesk@gmail.com>,
	"Randal L. Schwartz" <merlyn@stonehenge.com>,
	Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>,
	Sverre Rabbelier <srabbelier@gmail.com>,
	git list <git@vger.kernel.org>
Subject: Creating tracked branches
Date: Thu, 22 Apr 2010 13:49:24 +0200	[thread overview]
Message-ID: <20100422114924.GH3563@machine.or.cz> (raw)
In-Reply-To: <7vy6gf52d1.fsf@alter.siamese.dyndns.org>

On Thu, Apr 22, 2010 at 01:16:10AM -0700, Junio C Hamano wrote:
> Petr Baudis <pasky@suse.cz> 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

  reply	other threads:[~2010-04-22 11:49 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-21 21:13 git pull behavior changed? Aghiles
2010-04-21 21:22 ` Sverre Rabbelier
2010-04-21 21:34   ` Aghiles
2010-04-21 21:55   ` Aghiles
2010-04-21 21:59     ` Sverre Rabbelier
2010-04-21 21:59     ` Matthieu Moy
2010-04-21 22:04       ` Aghiles
2010-04-21 22:23         ` Matthieu Moy
2010-04-21 22:41           ` Aghiles
2010-04-22  0:01             ` Jeff King
2010-04-22  0:13               ` Aghiles
2010-04-22  0:41                 ` Jeff King
2010-04-22  1:27                   ` Aghiles
2010-04-22  2:10                     ` Jeff King
2010-04-21 23:27         ` Randal L. Schwartz
2010-04-21 23:57           ` Aghiles
2010-04-22  8:10             ` Petr Baudis
2010-04-22  8:16               ` Junio C Hamano
2010-04-22 11:49                 ` Petr Baudis [this message]
2010-04-22 13:47                   ` Creating tracked branches Andreas Schwab
2010-04-22 14:17                     ` Petr Baudis
2010-04-22 21:13                 ` git pull behavior changed? Aghiles

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100422114924.GH3563@machine.or.cz \
    --to=pasky@suse.cz \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=aghilesk@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=merlyn@stonehenge.com \
    --cc=srabbelier@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).