Re: Tools that do an automatic fetch defeat "git push --force-with-lease"
- Date: Sat, 8 Apr 2017 09:24:06 +0200
- From: lists@xxxxxxxxxxxxxxxx (Stefan Haller)
- Subject: Re: Tools that do an automatic fetch defeat "git push --force-with-lease"
Matt McCutchen <matt@xxxxxxxxxxxxxxxxx> wrote:
> When I'm rewriting history, "git push --force-with-lease" is a nice
> safeguard compared to "git push --force", but it still assumes the
> remote-tracking ref gives the old state the user wants to overwrite.
> Tools that do an implicit fetch, assuming it to be a safe operation,
> may break this assumption. In the worst case, Visual Studio Code does
> an automatic fetch every 3 minutes by default , making
> --force-with-lease pretty much reduce to --force.
That's a big problem, but even without such tools, I find
--force-with-lease without an argument to be pretty limited in
I like to type "git fetch" myself regularly, just to see what's new
upstream before integrating it; this already breaks it. But even
avoiding "git fetch" doesn't help if you are working on more than one
branch at a time, because doing "git pull" on one branch will do an
implicit "git fetch" on the other.
I like the idea of git maintaining a separate "last integrated" commit
for each branch, I think this could solve it in a nice way. I'm probably
not qualified enough to work on this myself though, but I'm happy to
give input if someone else wants to.