Subject: RE: Naming the --forec option [[Re: PATCH: improve git switch documentation]]

From: Felipe Contreras <[email-masked]>
Date: Sat, 10 Jul 2021 18:18:46 -0500

Martin wrote:
> On 10/07/2021 22:49, Felipe Contreras wrote:
> > Martin wrote:
> >> For each force-needing action, you should have to specify it's own force 
> >> flag. >
>  > OK, but I don't see the concrete proposal. What would be the
>  > flag that
>  > makes -c "forceful"?
>  >
> 
> Well that starts yet another topic.
> 
> At the moment, it is
>     --force-create which is absorbing the flag into the option.
> 
> And by (apparent) convention it also is the uppercasing of the option
>     -C
> same as the uppercasing of the -B in checkout.
> 
> I am not really sure if the uppercasing is the best idea.

Me neither, and it's not something I generally use.

> If your suggestion "core.advanced " were to come, I would vote that 
> uppercase single letter force options should be restricted to advanced.

I would not count on it. I suggested core.mode back in 2013 [1], so...

> If -n is introduced, we can think about what to do about -N.
> Should the  --force-*  style be kept?
>     --force-new
>     -N
> 
> Or the (unfortunate? / see below ) "--discard-changes" style:
>     --discard-existing-branch -n <branchname>
> 
> I am against using --reset instead of --force-new.

That's OK, and in fact I can see how '--reset --new' is clunky, I'm just
saying it is a possibility. But the main point is that something like
`git switch --reset` is missing, although `git switch --move` would
probably do the trick.

> At least I can say, if I use "-N", I want a *new* branch. I don't care 
> about any old branch under that name.

Right, I would as well, but in fact I would expect the same from -n
(although I can see how a newbie might not).

> Also "--reset" does not have the same alerting properties to me, as 
> "force" or "discard" have.
> This may be my English, but to me "reset" does not have the same 
> alerting property.

OK, maybe it's a language issue. I'm not a native English speaker, my
mother tongue is Spanish, but I'm pretty sure my understanding of
"reset" is what most people understand: set again.

Using Merriam Webster [2]:

  1: to set again or anew
  2: to change the reading of often to zero

And there's plenty of corroboration; reorder: order again (whatever
order you had is lost), reassign: assign again (whatever assignment you
had is gone), replay: play again (whatever you were playing is gone),
and so on.

> The general problem is, if there is more than one force-needing action, 
> then which one does -f  act on?
> 
> Any force-needing action, that only applies with another option (such as 
> -N) can have a --force-*. So the plain -f is not used for it.
> 
> But, what if more than one force-needing event can happen (not just 
> switch, but any command), even without any extra options? (May not yet 
> be the case / not checked).
> 
> git switch has attempted to solve that.
> The result IMHO is a disaster.
> "-f" / "--force" is made an alias in favour for
>     --discard-changes
> What changes?

I see.

So *if* --force was not an alias for --discard-changes, then this would
make sense:

  git switch --new --force topic

It would _force_ the creation of a _new_ branch called "topic".

Is this close to what you are thinking?

[1] https://lore.kernel.org/git/[email-masked]/
[2] https://www.merriam-webster.com/dictionary/reset

-- 
Felipe Contreras