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

Re: Would a config var for --force-with-lease be useful?

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Aug 27, 2018, 19:40 UTC
Message-ID
<87o9dnegxi.fsf@evledraar.gmail.com>
In-Reply-To
<xmqqin3vk3yv.fsf@gitster-ct.c.googlers.com>
On Mon, Aug 27 2018, Junio C Hamano wrote:
Show 27 quoted lines
> Scott Johnson <jaywir3@gmail.com> writes:
>
>> Hello Everyone:
>>
>> I'm considering writing a patch that adds a configuration variable
>> that will allow the user to default the command:
>>
>> git push --force
>>
>> to:
>>
>> git push --force-with-lease
>
> I actually consider "--force-with-lease" that does not say "this is
> what exactly I am expecting to replace with my version" a fairly
> dangerous form to recommend to the general public, unless their use
> of "git fetch" (or "git pull") is disciplined.  In the extreme case,
> if you habitually do "git fetch origin" only to update the remote
> tracking branches (so that you can do things like "git log ..origin"
> to see what others have been doing while you were offline), using
> "--force-with-lease" offers no value over "--force", as you're
> likely to find your remote-tracking ref to be up-to-date, but it no
> longer is what you based on your decision that replacing the tip
> with your version is safe.
>
> So, from that point of view, I would recommend thinking twice before
> considering to add such a configuration variable.

Last year there was a proposal for such a patch in: https://public-inbox.org/git/1499116727-757-1-git-send-email-f@mazzo.li/

This was after/during a long discussion starting with: https://public-inbox.org/git/CACBZZX7MeX-6RHgh2Fa9+YL03mjxs8xmyE86HnVxBxjMYizcig@mail.gmail.com/

It appears the only patch that got in from that discussion was my f17d642d3b ("push: document & test --force-with-lease with multiple remotes", 2017-04-19) (https://github.com/git/git/commit/f17d642d3b)

I still think something like such a config variable would be useful, as noted in https://public-inbox.org/git/8760f4bmig.fsf@gmail.com/ Junio voiced similar objections at the time.

It would be great to have some patch like this for consideration, but give that thread a read first to see what some of the objections were / various points raised for/against doing that.

Previous: Junio C HamanoNext: Junio C Hamano
Message 6 of 9 in “Would a config var for --force-with-lease be useful?”
  1. Scott JohnsonAug 24, 2018
  2. Constantin WeißerAug 25, 2018
  3. Johannes SchindelinAug 27, 2018
  4. Phillip WoodAug 28, 2018
  5. Junio C HamanoAug 27, 2018
  6. Ævar Arnfjörð BjarmasonAug 27, 2018
  7. Junio C HamanoAug 27, 2018
  8. Ævar Arnfjörð BjarmasonAug 27, 2018
  9. Junio C HamanoAug 27, 2018

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.