git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git checkout -b -t
@ 2009-06-02 14:49 John Tapsell
  2009-06-02 15:04 ` Junio C Hamano
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: John Tapsell @ 2009-06-02 14:49 UTC (permalink / raw)
  To: Git List

Hey all,

  I've become the "guy to ask about git" in my company and people are
always getting into a mess with git.  So in turn I try to get git to
be a more friendly.  Today someone had a problem.  Basically they had
done:

$ git checkout -t origin/mybranch
fatal: git checkout: --track and --no-track require -b

So they do exactly what it tells them:
$ git checkout -b -t origin/mybranch
Switched to a new branch "-t"

doh

How can we make this less easy for people to shoot themselves in the
foot?  The behavior of -t has changed recently iirc, so I think that
problem has gone away?

Also:
$ git branch -D -t

Doesn't work.  I can see why, but it does make my life difficult :-D

John

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: git checkout -b -t
  2009-06-02 14:49 git checkout -b -t John Tapsell
@ 2009-06-02 15:04 ` Junio C Hamano
  2009-06-02 15:05 ` Matthieu Moy
  2009-06-02 15:25 ` Michael J Gruber
  2 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2009-06-02 15:04 UTC (permalink / raw)
  To: John Tapsell; +Cc: Git List

John Tapsell <johnflux@gmail.com> writes:

> $ git checkout -t origin/mybranch
> fatal: git checkout: --track and --no-track require -b
>
> So they do exactly what it tells them:
> $ git checkout -b -t origin/mybranch
> Switched to a new branch "-t"
>
> doh
>
> How can we make this less easy for people to shoot themselves in the
> foot?

 (1) Explain things in terms of semantics, not in terms of "brainless
     cut&paste" operations.

 (2) Avoid telling them what to do in the error messages, instead why what
     they did is an error.

E.g. "--track/--no-track does not make sense if you are not creating a new
branch" would be far less confusing in this particular case.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: git checkout -b -t
  2009-06-02 14:49 git checkout -b -t John Tapsell
  2009-06-02 15:04 ` Junio C Hamano
@ 2009-06-02 15:05 ` Matthieu Moy
  2009-06-02 15:25 ` Michael J Gruber
  2 siblings, 0 replies; 4+ messages in thread
From: Matthieu Moy @ 2009-06-02 15:05 UTC (permalink / raw)
  To: John Tapsell; +Cc: Git List

John Tapsell <johnflux@gmail.com> writes:

> $ git branch -D -t
>
> Doesn't work.

Not really answering the question, but "git branch -D -- -t" should work.

-- 
Matthieu

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: git checkout -b -t
  2009-06-02 14:49 git checkout -b -t John Tapsell
  2009-06-02 15:04 ` Junio C Hamano
  2009-06-02 15:05 ` Matthieu Moy
@ 2009-06-02 15:25 ` Michael J Gruber
  2 siblings, 0 replies; 4+ messages in thread
From: Michael J Gruber @ 2009-06-02 15:25 UTC (permalink / raw)
  To: John Tapsell; +Cc: Git List

John Tapsell venit, vidit, dixit 02.06.2009 16:49:
> Hey all,
> 
>   I've become the "guy to ask about git" in my company and people are
> always getting into a mess with git.  So in turn I try to get git to
> be a more friendly.  Today someone had a problem.  Basically they had
> done:
> 
> $ git checkout -t origin/mybranch
> fatal: git checkout: --track and --no-track require -b
> 
> So they do exactly what it tells them:
> $ git checkout -b -t origin/mybranch
> Switched to a new branch "-t"
> 
> doh
> 
> How can we make this less easy for people to shoot themselves in the
> foot?  The behavior of -t has changed recently iirc, so I think that
> problem has gone away?

git 1.6.1 and above contains DWIMery which, in the case above, would
automatically behave like

git checkout -t origin/mybranch -b mybranch

which complains in case 'mybranch' exists already, without pointing at
'-b', though. Do you think this creates a new type of head aches for
your patients?

> 
> Also:
> $ git branch -D -t
> 
> Doesn't work.  I can see why, but it does make my life difficult :-D
> 
> John

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-06-02 15:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-02 14:49 git checkout -b -t John Tapsell
2009-06-02 15:04 ` Junio C Hamano
2009-06-02 15:05 ` Matthieu Moy
2009-06-02 15:25 ` Michael J Gruber

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).