[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git
Subject:    Re: [PATCH] checkout --track: make up a sensible branch name if '-b'
From:       Johannes Schindelin <Johannes.Schindelin () gmx ! de>
Date:       2008-08-09 21:08:04
Message-ID: alpine.DEB.1.00.0808092302520.24820 () pacific ! mpi-cbg ! de ! mpi-cbg ! de
[Download RAW message or body]

Hi,

On Sat, 9 Aug 2008, Junio C Hamano wrote:

> Junio C Hamano <gitster@pobox.com> writes:
> 
> > Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> >
> >> What does the user most likely want with this command?
> >>
> >> 	$ git checkout --track origin/next
> >>
> >> Exactly.  A branch called 'next', that tracks origin's branch 'next'.
> >
> > I like this.
> >
> > An explicit --track request from the command line (as opposed to 
> > happening to have "branch.autosetupmerge" configuration) is a very 
> > good cue that what the user wants to do is not to take a peek on a 
> > detached HEAD but a more permanent playpen created.
> 
> A couple more thoughts.

At first, I liked the thoughts, but...

> (1) You may not necessarily are used to --track, but may still want this
>     done.  It might not be a bad idea to associate this "local dwimming"
>     to creation of a new branch.  In other words, all of these:
> 
>     $ git checkout -b origin/next

This cannot be dwimmed, as it literally means "start a new branch called 
'origin/next' from HEAD".

So it would change the current behavior would, breaking people's habits (I 
do "git checkout -b bla" a lot when I realize that I want to have the 
current changes on a new branch).

>     $ git checkout -b --track origin/next

This is a clear syntax error.  By the same reasoning, we would have to 
allow "git add remote origin git://..."

I think allowing this would confuse the syntax, and foster unreasonable 
expectations.

>     $ git checkout --track origin/next

That is what my patch does.

> (2) If you work with somebody else, you might not want to have the name
>     mapping to be "s|^[^/]*/||" (i.e. drop "origin/"):
> 
>     $ git remote add -f jeff $url_to_his_repository
>     $ git checkout -b [--track] jeff-next jeff/next
>     $ git checkout -b [--track] origin-next origin/next

As I said, I think you must not allow switching around the options -b and 
--track.

And the rest of what you describe is already supported.

Ciao,
Dscho

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

Configure | About | News | Add a list | Sponsored by KoreLogic