git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Tools that do an automatic fetch defeat "git push --force-with-lease"
@ 2017-04-08  2:15 Matt McCutchen
  2017-04-08  7:24 ` Stefan Haller
                   ` (3 more replies)
  0 siblings, 4 replies; 49+ messages in thread
From: Matt McCutchen @ 2017-04-08  2:15 UTC (permalink / raw)
  To: git

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 [1], making
--force-with-lease pretty much reduce to --force.

For a safer workflow, "git push" would check against a separate "old"
ref that isn't updated by "git fetch", but is updated by "git push" the
same way the remote-tracking ref is and maybe also by commands that
update the local branch to take into account remote changes (I'm not
sure what reasonable scenarios there are, if any).  Has there been any
work on this?  I can write a wrapper script for the simple case of "git
push" of a single branch to the same branch on a remote, which is
pretty much all I use right now, but a native implementation would
support all of the command-line usage forms, which would be nice.

Thanks for reading!

[1]
https://github.com/Microsoft/vscode/blob/535a3de60023c81d75d0eac22044284f07dbcddf/extensions/git/src/autofetch.ts

Matt

^ permalink raw reply	[flat|nested] 49+ messages in thread

end of thread, other threads:[~2017-07-17 17:29 UTC | newest]

Thread overview: 49+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-08  2:15 Tools that do an automatic fetch defeat "git push --force-with-lease" Matt McCutchen
2017-04-08  7:24 ` Stefan Haller
2017-04-08  7:35 ` Ævar Arnfjörð Bjarmason
2017-04-08  9:29   ` Jeff King
2017-04-08 10:10     ` Jakub Narębski
2017-04-08 11:41       ` [PATCH] push: document & test --force-with-lease with multiple remotes Ævar Arnfjörð Bjarmason
2017-04-09  9:55         ` Simon Ruderich
2017-04-09 11:40           ` Ævar Arnfjörð Bjarmason
2017-04-17  3:56         ` Junio C Hamano
2017-04-19  9:22           ` [PATCH v2] " Ævar Arnfjörð Bjarmason
2017-04-08 21:54     ` Tools that do an automatic fetch defeat "git push --force-with-lease" Jacob Keller
2017-04-08 22:13       ` Jeff King
2017-04-08 22:21         ` Jacob Keller
2017-04-09  8:38         ` Stefan Haller
2017-04-09  8:49           ` Jacob Keller
2017-04-09 11:00             ` Stefan Haller
2017-04-10  8:08               ` Jacob Keller
2017-04-10  9:58                 ` Ævar Arnfjörð Bjarmason
2017-04-10 23:33                   ` Jacob Keller
2017-04-11  8:51                     ` Junio C Hamano
2017-04-12  9:11                       ` Stefan Haller
2017-07-06 18:56                       ` [PATCH] push: disable lazy --force-with-lease by default Junio C Hamano
2017-07-06 19:38                         ` Stefan Beller
2017-07-06 22:39                           ` Junio C Hamano
2017-07-06 22:42                             ` Stefan Beller
2017-07-10 22:32                             ` Stefan Beller
2017-07-07  9:24                         ` Stefan Haller
2017-07-07  9:42                           ` Jeff King
2017-07-07  9:54                           ` Ævar Arnfjörð Bjarmason
2017-07-07 15:15                             ` Junio C Hamano
2017-07-15 10:45                               ` Ævar Arnfjörð Bjarmason
2017-07-17 17:28                                 ` Junio C Hamano
2017-07-07  9:39                         ` Ævar Arnfjörð Bjarmason
2017-04-11 12:37                   ` Tools that do an automatic fetch defeat "git push --force-with-lease" Stefan Haller
2017-04-11 12:37                 ` Stefan Haller
2017-04-10 18:31           ` Jeff King
2017-04-11 12:37             ` Stefan Haller
2017-04-11 12:50               ` Jeff King
2017-04-12  9:11                 ` Stefan Haller
2017-04-09  8:38       ` Stefan Haller
2017-04-09  8:46         ` Jacob Keller
2017-04-08  8:25 ` Jacob Keller
2017-04-08  9:31   ` Jeff King
2017-04-08 15:03     ` Stefan Haller
2017-04-08 22:03       ` Jeff King
2017-04-08 15:03 ` Stefan Haller
2017-04-08 16:04   ` Ævar Arnfjörð Bjarmason
2017-04-08 17:28     ` Stefan Haller
2017-04-12  9:11   ` Stefan Haller

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).