From: Junio C Hamano <gitster@pobox.com>
To: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Cc: Phil Hord <phil.hord@gmail.com>, Ryan Lortie <desrt@desrt.ca>,
Thomas Rast <trast@student.ethz.ch>,
git@vger.kernel.org
Subject: Re: 'git branch' when origin branch with same name exists
Date: Wed, 20 Jun 2012 11:07:52 -0700 [thread overview]
Message-ID: <7v62alx3ev.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <vpqa9zxan3a.fsf@bauges.imag.fr> (Matthieu Moy's message of "Wed, 20 Jun 2012 19:51:21 +0200")
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Requiring starting point and failing without --force will never
>> happen, but it could be a possible approach to issue an additional
>> advice message under reasonably narrow conditions, namely:
>>
>> - The starting point was not given explicitly;
>>
>> - It would have DWIMed to "git checkout -t -b it origin/it" when
>> creating the branch (I think you need to check configurations
>> like branch.autosetupmerge and existence of the tracking branch
>> remotes/origin/it); and
>>
>> - advice.branchNotTrackingCorrespondingRemote is not set to false.
>
> I like that. Stg like
>
> $ git branch next
> Creating local branch next starting from <sha1>.
> If you meant to checkout a new branch 'next' to track remote branch
> 'next' from 'origin', run these commands now:
> git branch -d next; git checkout next
Oh, another precondition would be that --force was _not_ given.
It is fairly clear "git branch -f next" is asking to forcibly update
an existing local 'next' to the current HEAD, not to origin/next,
and giving the above suggestion will be mildly irritating in such a
case.
next prev parent reply other threads:[~2012-06-20 18:08 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-19 14:51 'git branch' when origin branch with same name exists Ryan Lortie
2012-06-19 15:18 ` jaseem abid
2012-06-19 15:35 ` Michael Schubert
2012-06-19 15:54 ` Ryan Lortie
2012-06-19 16:17 ` Philippe Vaucher
2012-06-19 15:57 ` Angus Hammond
2012-06-19 16:06 ` Konstantin Khomoutov
2012-06-19 17:06 ` Ryan Lortie
2012-06-20 8:31 ` Andreas Ericsson
2012-06-19 17:21 ` Thomas Rast
2012-06-19 18:31 ` Junio C Hamano
2012-06-19 20:44 ` Ryan Lortie
2012-06-19 21:32 ` Junio C Hamano
2012-06-19 21:50 ` Ryan Lortie
2012-06-19 23:21 ` Phil Hord
2012-06-20 17:32 ` Junio C Hamano
2012-06-20 17:51 ` Matthieu Moy
2012-06-20 18:07 ` Junio C Hamano [this message]
2012-06-19 18:22 ` Junio C Hamano
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=7v62alx3ev.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=Matthieu.Moy@grenoble-inp.fr \
--cc=desrt@desrt.ca \
--cc=git@vger.kernel.org \
--cc=phil.hord@gmail.com \
--cc=trast@student.ethz.ch \
/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).