Re: Proposalö git push -F
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Mar 4, 2021, 10:02 UTC
- Message-ID
- <nycvar.QRO.7.76.6.2103041045420.57@tvgsbejvaqbjf.bet>
- In-Reply-To
- <xmqqim68lp20.fsf@gitster.c.googlers.com>
Hi,
On Tue, 2 Mar 2021, Junio C Hamano wrote:
Show 12 quoted lines
> XonqNopp <xonqnoppp@gmail.com> writes: > > > I have discovered some months ago that it is more safe to force a push with > > git push --force-with-lease > > > > But since then I keep wondering: why is this not the default? > > Because the form "--force-with-lease=<this-exact-commit>" is a > strict improvement over "--force", but the lazy "guess where the > other end should be" form, i.e. "--force-with-lease" alone, is worse > than "--force" in that it gives users false sense of security > without offering the safety the "lease" mechanism gives.
To add to that: some tools helpfully fetch in the background, therefore remote-tracking branches are updated _without_ the user being aware of it. In this instance, `--force-with-lease` is very dangerous.
We did introduce the `--force-if-includes` option, but it seems that we made this option _not_ imply `--force-with-lease`, which makes it an unwieldy `git push --force-with-lease --force-if-includes <refspec>`, which admittedly not even _I_ type, and I really would benefit from this option.
Maybe it is time to admit that `--force-if-includes` should imply `--force-with-lease`, and then add `-F` as a shortcut?
Ciao, Johannes