Subject: Re: [PATCH 2/2] checkout: introduce "--to-branch" option

From: Junio C Hamano <[email-masked]>
Date: Sun, 12 Dec 2021 10:46:23 -0800

ZheNing Hu <[email-masked]> 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.