git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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.
Previous: Kipras Melnikovas
Message 7 of 7 in “Short form of --force-with-lease”
  1. Wyatt CarpenterApr 11, 2024
  2. Kipras MelnikovasApr 11, 2024
  3. rsbecker@nexbridge.comApr 11, 2024
  4. Kipras MelnikovasApr 11, 2024
  5. Kyle LippincottApr 11, 2024
  6. Kipras MelnikovasApr 12, 2024
  7. Junio C HamanoApr 11, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.