* Short form of --force-with-lease
@ 2024-04-11 17:16 Wyatt Carpenter
2024-04-11 17:36 ` Kipras Melnikovas
0 siblings, 1 reply; 7+ messages in thread
From: Wyatt Carpenter @ 2024-04-11 17:16 UTC (permalink / raw)
To: git
I often use git push --force-with-lease; it does exactly what I need.
Is there a short form of the flag, like -f is for --force? If not, I
would like to propose -l be added as one. I don't believe git push has
an -l flag currently, and l is of course the first letter of lease.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Short form of --force-with-lease
2024-04-11 17:16 Short form of --force-with-lease Wyatt Carpenter
@ 2024-04-11 17:36 ` Kipras Melnikovas
2024-04-11 19:21 ` rsbecker
0 siblings, 1 reply; 7+ messages in thread
From: Kipras Melnikovas @ 2024-04-11 17:36 UTC (permalink / raw)
To: wyattscarpenter; +Cc: git
I have also thought about this.
I'd suggest a config option "push.forceFlagBehavior" that would allow to
configure the behavior, one of:
- "default" / "overwrite", which is currently -f,
- "lease" for --force-with-lease,
- "lease-includes" for --force-with-lease --force-if-includes,
- possibly others.
Then, upon `git push -f`, the config option would be consulted to determine the
behavior.
To get the default behavior, `-f -f` or `-F` could be used.
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: Short form of --force-with-lease
2024-04-11 17:36 ` Kipras Melnikovas
@ 2024-04-11 19:21 ` rsbecker
2024-04-11 20:32 ` Kipras Melnikovas
2024-04-11 21:30 ` Junio C Hamano
0 siblings, 2 replies; 7+ messages in thread
From: rsbecker @ 2024-04-11 19:21 UTC (permalink / raw)
To: 'Kipras Melnikovas', wyattscarpenter; +Cc: git
On Thursday, April 11, 2024 1:37 PM, Kipras Melnikovas wrote:
>I'd suggest a config option "push.forceFlagBehavior" that would allow to
configure
>the behavior, one of:
>- "default" / "overwrite", which is currently -f,
>- "lease" for --force-with-lease,
>- "lease-includes" for --force-with-lease --force-if-includes,
>- possibly others.
>
>Then, upon `git push -f`, the config option would be consulted to determine
the
>behavior.
>
>To get the default behavior, `-f -f` or `-F` could be used.
If this is mostly about saving typing, you could get a similar effect adding
an alias. Something like
git config --global alias.pushfl 'push --force-with-lease'
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Short form of --force-with-lease
2024-04-11 19:21 ` rsbecker
@ 2024-04-11 20:32 ` Kipras Melnikovas
2024-04-11 20:58 ` Kyle Lippincott
2024-04-11 21:30 ` Junio C Hamano
1 sibling, 1 reply; 7+ messages in thread
From: Kipras Melnikovas @ 2024-04-11 20:32 UTC (permalink / raw)
To: rsbecker; +Cc: git, kipras, wyattscarpenter
> If this is mostly about saving typing, you could get a similar effect adding
> an alias. Something like
>
> git config --global alias.pushfl 'push --force-with-lease'
Correct, and I already have an alias:
'pf = push --force-with-lease --force-if-includes'.
However, I see the config option more valuable - it would protect against
accidental `push -f`, which, out of habit, is very probable to run on accident.
With the config option, would feel safe and wouldn't need the alias either.
Thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Short form of --force-with-lease
2024-04-11 20:32 ` Kipras Melnikovas
@ 2024-04-11 20:58 ` Kyle Lippincott
2024-04-12 9:00 ` Kipras Melnikovas
0 siblings, 1 reply; 7+ messages in thread
From: Kyle Lippincott @ 2024-04-11 20:58 UTC (permalink / raw)
To: Kipras Melnikovas; +Cc: rsbecker, git, wyattscarpenter
On Thu, Apr 11, 2024 at 1:34 PM Kipras Melnikovas <kipras@kipras.org> wrote:
>
> > If this is mostly about saving typing, you could get a similar effect adding
> > an alias. Something like
> >
> > git config --global alias.pushfl 'push --force-with-lease'
>
> Correct, and I already have an alias:
> 'pf = push --force-with-lease --force-if-includes'.
>
> However, I see the config option more valuable - it would protect against
> accidental `push -f`, which, out of habit, is very probable to run on accident.
> With the config option, would feel safe and wouldn't need the alias either.
It would normalize the use of `push -f` in people's muscle memory,
which would be a potential disaster if someone lost their
configuration, but not this muscle memory. It also would break
automation/scripts - `git push` is likely used by both humans and
automation (custom one-off automation like a personal script, or
automation shared by many people) - if they're expecting `git push -f`
to do the legacy behavior, then it'll break things if the meaning of
`-f` changes. A separate flag (or just using an alias if it's for
saving typing) would be safer.
>
> Thanks.
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Short form of --force-with-lease
2024-04-11 19:21 ` rsbecker
2024-04-11 20:32 ` Kipras Melnikovas
@ 2024-04-11 21:30 ` Junio C Hamano
1 sibling, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2024-04-11 21:30 UTC (permalink / raw)
To: rsbecker; +Cc: 'Kipras Melnikovas', wyattscarpenter, git
<rsbecker@nexbridge.com> writes:
> If this is mostly about saving typing, you could get a similar effect adding
> an alias. Something like
>
> git config --global alias.pushfl 'push --force-with-lease'
The use of --force-with-lease without specifying which commit you
took lease on is not all that safe [*], so I am not sure how useful
such an alias will be.
Configuring how "--force" behaves and changing it to an unadorned
"--force-with-lease" is to promote a not-so-safe feature as if it is
safe with false sense of safety, which is not something we would
want to do.
[Footnote]
* This of course highly depends on your workflow and third-party
companion tools. If you (or your IDE in the background) fetch
from the remote after you started working on the commit to be
force-pushed, it would update the tip of the remote-tracking
branch, making --force-with-lease base its decision on a wrong
commit that your work is not based on.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Short form of --force-with-lease
2024-04-11 20:58 ` Kyle Lippincott
@ 2024-04-12 9:00 ` Kipras Melnikovas
0 siblings, 0 replies; 7+ messages in thread
From: Kipras Melnikovas @ 2024-04-12 9:00 UTC (permalink / raw)
To: spectral; +Cc: git, kipras, rsbecker, wyattscarpenter
> > > If this is mostly about saving typing, you could get a similar effect adding
> > > an alias. Something like
> > >
> > > git config --global alias.pushfl 'push --force-with-lease'
> >
> > Correct, and I already have an alias:
> > 'pf = push --force-with-lease --force-if-includes'.
> >
> > However, I see the config option more valuable - it would protect against
> > accidental `push -f`, which, out of habit, is very probable to run on accident.
> > With the config option, would feel safe and wouldn't need the alias either.
>
> It would normalize the use of `push -f` in people's muscle memory,
> which would be a potential disaster if someone lost their
> configuration, but not this muscle memory. It also would break
> automation/scripts - `git push` is likely used by both humans and
> automation <...>. A separate flag (or just using an alias if it's for
> saving typing) would be safer.
Fair point, I retract my config option proposal.
A separate flag, as proposed by OP, would make more sense. Thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-04-12 9:00 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-11 17:16 Short form of --force-with-lease Wyatt Carpenter
2024-04-11 17:36 ` Kipras Melnikovas
2024-04-11 19:21 ` rsbecker
2024-04-11 20:32 ` Kipras Melnikovas
2024-04-11 20:58 ` Kyle Lippincott
2024-04-12 9:00 ` Kipras Melnikovas
2024-04-11 21:30 ` Junio C Hamano
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).