git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: "ZheNing Hu" <adlternative@gmail.com>,
	"ZheNing Hu via GitGitGadget" <gitgitgadget@gmail.com>,
	"Git List" <git@vger.kernel.org>,
	"Christian Couder" <christian.couder@gmail.com>,
	"Hariom Verma" <hariom18599@gmail.com>,
	"brian m. carlson" <sandals@crustytoothpaste.net>,
	"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
	"Eric Sunshine" <sunshine@sunshineco.com>
Subject: Re: [PATCH 2/2] checkout: introduce "--to-branch" option
Date: Mon, 13 Dec 2021 13:52:33 -0800	[thread overview]
Message-ID: <xmqqh7bcb2am.fsf@gitster.g> (raw)
In-Reply-To: <xmqqr1agb313.fsf@gitster.g> (Junio C. Hamano's message of "Mon, 13 Dec 2021 13:36:40 -0800")

Junio C Hamano <gitster@pobox.com> writes:

> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>
>> I don't see how it's fundimentally different than the DWIM logic of
>> taking "<name>" and seeing that there's only one "refs/heads/<name>",
>> and giving up in other cases where we get ambiguous reference names that
>> we can't resolve.
>
> In that example, once you obtained a local branch whose name is
> <name>, it is obvious how you would work with that.  Your next "git
> checkout <name>" 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 <tag>" 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 <tag> you will use the "--to-branch <tag>" with, because it
finds the branch whose tip exactly points at the tag.

You can use the command exactly once for the <tag> 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 <tag>", because (1) it was the only one
that pointed at <tag> 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 <next-branch> <tag>" in
preparation for the next time you might want to use "--to-branch
<tag>" and keep that pristine?

I do not think of any similar counterpart in "teach checkout <name>
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.


      reply	other threads:[~2021-12-13 21:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-10  6:22 [PATCH 0/2] checkout: introduce "--to-branch" option ZheNing Hu via GitGitGadget
2021-12-10  6:22 ` [PATCH 1/2] checkout: handling branch_info memory leak ZheNing Hu via GitGitGadget
2021-12-10  7:13   ` Ævar Arnfjörð Bjarmason
2021-12-10  6:22 ` [PATCH 2/2] checkout: introduce "--to-branch" option ZheNing Hu via GitGitGadget
2021-12-10  8:34   ` Christian Couder
2021-12-11  6:34     ` ZheNing Hu
2021-12-10  8:59   ` Ævar Arnfjörð Bjarmason
2021-12-11  7:11     ` ZheNing Hu
2021-12-10 11:51   ` Bagas Sanjaya
2021-12-11  7:12     ` ZheNing Hu
2021-12-10 22:14   ` Junio C Hamano
2021-12-11  7:51     ` ZheNing Hu
2021-12-12 18:46       ` Junio C Hamano
2021-12-13 19:55         ` Ævar Arnfjörð Bjarmason
2021-12-13 21:36           ` Junio C Hamano
2021-12-13 21:52             ` Junio C Hamano [this message]

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqh7bcb2am.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=adlternative@gmail.com \
    --cc=avarab@gmail.com \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=hariom18599@gmail.com \
    --cc=pclouds@gmail.com \
    --cc=sandals@crustytoothpaste.net \
    --cc=sunshine@sunshineco.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).