Re: 'git branch' when origin branch with same name exists

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

 



Matthieu Moy <Matthieu.Moy@xxxxxxxxxxxxxxx> writes:

> Junio C Hamano <gitster@xxxxxxxxx> 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.
--
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]