From: Junio C Hamano <gitster@pobox.com>
To: "Pasteley Absurda via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Pasteley Absurda <ceasebeing@gmail.com>
Subject: Re: [PATCH] checkout: add remoteBranchTemplate config for DWIM branch names
Date: Mon, 22 Dec 2025 13:40:45 +0900 [thread overview]
Message-ID: <xmqqtsxjruwi.fsf@gitster.g> (raw)
In-Reply-To: <pull.2136.git.git.1766332796836.gitgitgadget@gmail.com> (Pasteley Absurda via GitGitGadget's message of "Sun, 21 Dec 2025 15:59:56 +0000")
"Pasteley Absurda via GitGitGadget" <gitgitgadget@gmail.com> writes:
> From: pasteley <ceasebeing@gmail.com>
>
> Add checkout.remoteBranchTemplate to apply a template pattern when
> searching for remote branches during checkout DWIM and when creating
> remote branches with push.autoSetupRemote.
>
> Template uses printf-style placeholders (%s for branch name). For
> example, with "feature/%s", checking out "foo"
> searches for "origin/feature/foo" and creates local "foo"
> tracking it. Pushing with autoSetupRemote creates "origin/feature/bar"
> from local "bar".
>
> Useful when remote branches use prefixes but local branches don't.
It fells that this is presented backwards. The usefulness of the
layout that names local branches deliberately differently from their
remote counterparts needs to be justified first. Only after that,
we can consider adding extra mechanism to support such a layout.
Once "git checkout foo" is taught to do the same as "git checkout -b
extra-foo -t origin/foo", it would create
[branch "extra-foo"]
remote = origin
merge = refs/heads/foo
but the push side would need extra work, and that is why you needed
to muck with the push refspec. But then what should happen when the
user is using "we do not bother remembering what branches to push
there; the remote repository remembers that for us", aka "matching
push"?
Most of the problems is what you are creating by using an unusual
layout to name local branches differently from the remote
counterpart. You do not have to, and then all the problems you
created with that layout goes away, without this patch.
So, I am not sure if this is a good idea to begin with. At least, I
am not yet convinced.
Thanks.
next prev parent reply other threads:[~2025-12-22 4:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-21 15:59 [PATCH] checkout: add remoteBranchTemplate config for DWIM branch names Pasteley Absurda via GitGitGadget
2025-12-22 4:40 ` Junio C Hamano [this message]
2025-12-22 18:27 ` pasteley
2025-12-23 0:51 ` Junio C Hamano
2025-12-23 2:39 ` pasteley
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=xmqqtsxjruwi.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=ceasebeing@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.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).