Re: Short form of --force-with-lease
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 11, 2024, 21:30 UTC
- Message-ID
- <xmqq7ch3r3i3.fsf@gitster.g>
- In-Reply-To
- <01e101da8c45$66d33240$347996c0$@nexbridge.com>
<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.