From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id CC79B1F953 for ; Mon, 13 Dec 2021 21:52:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243231AbhLMVwh (ORCPT ); Mon, 13 Dec 2021 16:52:37 -0500 Received: from pb-smtp1.pobox.com ([64.147.108.70]:62436 "EHLO pb-smtp1.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243225AbhLMVwf (ORCPT ); Mon, 13 Dec 2021 16:52:35 -0500 Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id EA7F91114A8; Mon, 13 Dec 2021 16:52:34 -0500 (EST) (envelope-from junio@pobox.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; s=sasl; bh=dbPcbfmUO+ak rIsuM2yUeAYOjb45bnQu7rGCARtYt5c=; b=yDk382XMPGrEgs1gQmkWQUUYTTW3 tklKsKOSDqRRJZJY+MdvNJbr9Xf/2a5heO/Hf75oErzJlGPj92tHwAYOXicYxsjp QaZaG1sjAP/6I0CePBmc2AjPIG/qU1JsbYjAK5q+6mMEgNjSCohfT5UjBb6v4FjX TIwEI1uYm0sTHJA= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id E1EE11114A7; Mon, 13 Dec 2021 16:52:34 -0500 (EST) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [104.133.2.91]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id 4A1C71114A6; Mon, 13 Dec 2021 16:52:34 -0500 (EST) (envelope-from junio@pobox.com) From: Junio C Hamano To: =?utf-8?B?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason Cc: ZheNing Hu , ZheNing Hu via GitGitGadget , Git List , Christian Couder , Hariom Verma , "brian m. carlson" , =?utf-8?B?Tmd1eeG7hW4gVGjDoWkgTmfhu41j?= Duy , Eric Sunshine Subject: Re: [PATCH 2/2] checkout: introduce "--to-branch" option References: <254b352e31029d8151eb6a974fdf8c127340cf79.1639117329.git.gitgitgadget@gmail.com> <211213.86r1ag6ztx.gmgdl@evledraar.gmail.com> Date: Mon, 13 Dec 2021 13:52:33 -0800 In-Reply-To: (Junio C. Hamano's message of "Mon, 13 Dec 2021 13:36:40 -0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 X-Pobox-Relay-ID: FAA18A6C-5C5E-11EC-822B-E10CCAD8090B-77302942!pb-smtp1.pobox.com Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Junio C Hamano writes: > =C3=86var Arnfj=C3=B6r=C3=B0 Bjarmason writes: > >> I don't see how it's fundimentally different than the DWIM logic of >> taking "" and seeing that there's only one "refs/heads/", >> and giving up in other cases where we get ambiguous reference names th= at >> we can't resolve. > > In that example, once you obtained a local branch whose name is > , it is obvious how you would work with that. Your next "git > checkout " would work on the local one, and only the initial > one does something magical. > > Which makes quite a lot of sense. > > There is no similarity in it with "--to-branch " that is being > discussed here. Another thing you seem to be ignoring is that it requires you to prepare in advance and keep one (and only one) dormant branch for the you will use the "--to-branch " with, because it finds the branch whose tip exactly points at the tag. You can use the command exactly once for the and check out that branch, but then what? Once you start working on that branch, you would by definition no longer have a suitable branch that can be used to with "--to-branch ", because (1) it was the only one that pointed at or you'd have gotten an error, and (2) you have moved the tip of the branch so it no longer points at the tag. And you'd expect the user to say "git branch " in preparation for the next time you might want to use "--to-branch " and keep that pristine? I do not think of any similar counterpart in "teach checkout to dwim and fork from a remote-tracking branch from a remote, if there is no other remote with a branch with that name" DWIMming to these nonsense.