git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git push --confirm ?

From
Owen Taylor <otaylor@redhat.com>
Date
Sep 12, 2009, 17:51 UTC
Message-ID
<1252777897.2974.24.camel@localhost.localdomain>

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
Next: Jeff King
Message 1 of 10 in “git push --confirm ?”
  1. Owen TaylorSep 12, 2009
  2. Jeff KingSep 12, 2009
  3. Owen TaylorSep 12, 2009
  4. Jeff KingSep 12, 2009
  5. Daniel BarkalowSep 12, 2009
  6. Junio C HamanoSep 13, 2009
  7. Jeff KingSep 13, 2009
  8. Junio C HamanoSep 13, 2009
  9. Jeff KingSep 13, 2009
  10. Uri OkrentSep 13, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.