git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Owen Taylor <otaylor@redhat.com>
To: git@vger.kernel.org
Cc: Colin Walters <walters@verbum.org>
Subject: git push --confirm ?
Date: Sat, 12 Sep 2009 13:51:37 -0400	[thread overview]
Message-ID: <1252777897.2974.24.camel@localhost.localdomain> (raw)

[-- 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 --]

             reply	other threads:[~2009-09-12 17:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-12 17:51 Owen Taylor [this message]
2009-09-12 18:43 ` git push --confirm ? 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1252777897.2974.24.camel@localhost.localdomain \
    --to=otaylor@redhat.com \
    --cc=git@vger.kernel.org \
    --cc=walters@verbum.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).