git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: ZheNing Hu <adlternative@gmail.com>
Cc: "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>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Eric Sunshine" <sunshine@sunshineco.com>
Subject: Re: [PATCH 2/2] checkout: introduce "--to-branch" option
Date: Sun, 12 Dec 2021 10:46:23 -0800	[thread overview]
Message-ID: <xmqqy24pk6f4.fsf@gitster.g> (raw)
In-Reply-To: <CAOLTT8Rx9M9=a5M8UeDrJqMayTXo=dvdanVDLi7QLdPX8W_Tzw@mail.gmail.com> (ZheNing Hu's message of "Sat, 11 Dec 2021 15:51:01 +0800")

ZheNing Hu <adlternative@gmail.com> writes:

>> It is unclear if you mean "dev1" exactly point at the commit tagged
>> as v1.1, or you want the branch "dev1" that is a descedanant of
>> v1.1.  Without telling that to the reader, the above explanation is
>> useless.
>>
>
> I meant the former.
>
>> And whether you meant the former or the latter, neither use case does
>> not make much sense.
>> ...
>> So, "--to-branch v1.1" that finds and checks out a branch whose tip
>> exactly points at v1.1 would be pretty useless.
> ...
> "git branch --contains v1.1" can find all branches whose history contains the
>  commit tagged as v1.1. So what if "git checkout --contains v1.1"?

I already said, whether you meant "the only branch that points
exactly at" or "the only branch that contains", the feature does not
make sense.  Forcing users to keep only a single branch that either
points at a given tag is simply impossible and also useless.  Once
the branch gains even a single commit, it will no loger be pointing
at the tag, so "let's prepare a branch pointing at v1.1 just in case
when I want to start working from there" would not be a good
workflow to begin with.  Forcing users to keep only a single branch
that contains a given tag would encourage even a worse workflow to
throw in unrelated things, whose only commonality is that they all
want to fork from a single tag, into a single branch.

IOW, there is nothing we want to add to "git checkout/switch" for
this topic.  "git checkout --contains $tag" smells like a solution
looking for a problem.



  reply	other threads:[~2021-12-12 18:46 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 [this message]
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

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=xmqqy24pk6f4.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.
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).