Web lists-archives.com

Re: Tools that do an automatic fetch defeat "git push --force-with-lease"

On Tue, Apr 11, 2017 at 8:33 AM, Jacob Keller <jacob.keller@xxxxxxxxx> wrote:
> If you're already copying sha1s around you could use those as the
> --force-with-lease=branch:<commit>, no?
> That's better guarantee than just using --force-with-lease alone.

Absolutely. That was the _only_ way the feature was originally designed
to be used sensibly. We really shouldn't have added that "lazy" option that
assumed that most people used remote tracking branches only when they
need to fetch to see what's there, without making sure the assumption is
actually true. The "lazy" side of the feature ended up not being something
that would work for most people; it instead has become something that
only works for those with specific workflow (and a worse part is that those
who step outside the assumed workflow won't even get a warning).

Perhaps we should deprecate that "lazy" feature and remove it over
time, making sure that everybody feeds the explicit commit object name
that was recorded by the user somewhere (e.g. the approach to tag the
commit to record the expected remote tip, which Peff illustrated).