git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git push --confirm ?
@ 2009-09-12 17:51 Owen Taylor
  2009-09-12 18:43 ` Jeff King
  0 siblings, 1 reply; 10+ messages in thread
From: Owen Taylor @ 2009-09-12 17:51 UTC (permalink / raw)
  To: git; +Cc: Colin Walters

[-- Attachment #1: Type: text/plain, Size: 1369 bytes --]

People sometimes push things they don't mean to. Depending on the
workflow and environment, that can be anywhere between a trivial
nuisance to an embarrassing and awkward cleanup.

It would seem handy to me to have a --confirm option to git-push
(and 'core.confirm-push' to turn it on be default), that would
have the following behavior:

 * An initial --dry-run pass is done but with more verbosity -
   for updates of existing references, it would show what commits
   were being added or removed in a one-line format.

 * The user is prompted if they want to proceed
 
 * If the user agrees, then the push is run without --dry-run

I've attached a mockup of this as a porcelain 'git safe-push'.

(Done not using 'git push --porcelain' because I wanted it to work
with existing released Git versions. I was hoping to be able to do 
'git config alias.push safe-push', but no facility for interactive 
only aliases...)

I think this wouldn't be too hard to add to 'git push', though
I haven't tried to code it. Yes, it's not atomic without protocol
changes - I think that's OK:

 - If the push isn't being forced intermediate ref updates will
   be caught as a non-fast-forward in the second pass.

 - If the push is being forced, you might overwrite someone else's
   push anyways even without --confirm.

Thoughts on whether this makes sense as an addition?

- Owen


[-- Attachment #2: git-safe-push --]
[-- Type: application/x-shellscript, Size: 2584 bytes --]

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

end of thread, other threads:[~2009-09-13 16:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-12 17:51 git push --confirm ? Owen Taylor
2009-09-12 18:43 ` Jeff King
2009-09-12 20:11   ` Owen Taylor
2009-09-12 20:49     ` Jeff King
2009-09-12 21:55       ` Daniel Barkalow
2009-09-13  0:41   ` Junio C Hamano
2009-09-13  9:33     ` Jeff King
2009-09-13 10:37       ` Junio C Hamano
2009-09-13 10:52         ` Jeff King
2009-09-13 16:59           ` Uri Okrent

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 NNTP newsgroup(s).