From: Junio C Hamano <gitster@pobox•com>
To: Justin Tobler <jltobler@gmail•com>
Cc: git@vger•kernel.org, ps@pks•im
Subject: Re: [PATCH 1/2] builtin: remove merge short flag for switch and restore
Date: Tue, 22 Jul 2025 13:54:34 -0700 [thread overview]
Message-ID: <xmqq1pq8rlo5.fsf@gitster.g> (raw)
In-Reply-To: <20250722180818.1043014-2-jltobler@gmail.com> (Justin Tobler's message of "Tue, 22 Jul 2025 13:08:17 -0500")
Justin Tobler <jltobler@gmail•com> writes:
> Both git-switch(1) and git-restore(1) inherit some common options from
> git-checkout(1). One such option is the `--merge` flag and its
> accompanying short flag `-m`.
>
> In previous discussion[1] around removing the experimental marker for
> git-switch(1), it has been suggested that this short flag could instead
> be used for an option similar to `--move` from git-branch(1). Such a
> feature is not yet implemented for this command, but reserving a short
> flag for an uncommon option is unnecessary and hinders potential future
> extension.
>
> While these commands are still marked as experimental, remove the `-m`
> flag from both git-switch(1) and git-restore(1) and update the
> documentation accordingly.
Surely the whole point of marking the commands as experimental is to
allow us to make a change like this one.
I doubt that this particular one is a sensible change, though.
"git checkout -m <another-branch>" is one of the most frequently
used operation in my daily workflow, and having to type "git switch
--merge" (not having to learn to do so) would be a major annoyance.
> The `--conflict` flag is also now defined
> explicitly for each command as to remain alongside its related `--merge`
> companion.
I doubt this is a wise move. Unless we are planning to make the
option diverge across these three commands, that is.
The main logic that implements the "move to a different branch,
while merging local changes into the new base" does use these two
things together in the same code path (in merge_working_tree()).
The same for "check out a single path out to the working tree",
which does use these two things together in the same code path (in
checkout_merged()). I actually think keeping it in the common part
would help the readers of the code even more---by making it clear
that these three commands parse the option exactly the same way.
next prev parent reply other threads:[~2025-07-22 20:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-22 18:08 [PATCH 0/2] builtin: unmark git-switch and git-restore as experimental Justin Tobler
2025-07-22 18:08 ` [PATCH 1/2] builtin: remove merge short flag for switch and restore Justin Tobler
2025-07-22 20:54 ` Junio C Hamano [this message]
2025-07-22 21:16 ` Justin Tobler
2025-07-22 18:08 ` [PATCH 2/2] builtin: unmark git-switch and git-restore as experimental Justin Tobler
2025-07-22 21:00 ` Junio C Hamano
2025-07-22 21:20 ` Justin Tobler
2025-07-22 20:22 ` [PATCH 0/2] " Junio C Hamano
2025-07-22 21:32 ` Justin Tobler
2025-07-28 19:42 ` [PATCH] " Justin Tobler
2025-07-28 20: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=xmqq1pq8rlo5.fsf@gitster.g \
--to=gitster@pobox$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=jltobler@gmail$(echo .)com \
--cc=ps@pks$(echo .)im \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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