Re: Proposalö git push -F
flat view
From: Johannes Schindelin <hidden>
Date: 2021-03-04 12:11:12
Hi, On Tue, 2 Mar 2021, Junio C Hamano wrote:
XonqNopp [off-list ref] writes:quoted
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