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

Re: [PATCH] add-interactive: shortcut to add hunk and quit

From
Jeff King <peff@peff.net>
Date
May 18, 2011, 06:45 UTC
Message-ID
<20110518064515.GA29612@sigill.intra.peff.net>
In-Reply-To
<4DD369C3.4070806@pcharlan.com>
On Tue, May 17, 2011 at 11:40:03PM -0700, Pete Harlan wrote:
Show 16 quoted lines
> On 05/17/2011 12:12 AM, Hermann Gausterer wrote:
> > this combines the two "add -i" commands "y"+"q" to one.
> 
> ...
> 
> >         y - stage this hunk
> >         n - do not stage this hunk
> >         q - quit; do not stage this hunk nor any of the remaining ones
> > +       Q - stage this hunk but none of the remaining ones
> >         a - stage this hunk and all later hunks in the file
> >         d - do not stage this hunk nor any of the later hunks in the file
> >         g - select a hunk to go to
> 
> If "q" means "quit", I would expect "Q" to mean something like "quit
> immediately" (perhaps even undoing earlier adds), not "do something
> that 'q' wouldn't do, and then quit".

I agree. There was some discussion in another thread recently of the atomicity of git-add (right now it applies the changes to each file after all of its hunks are done). I would expect "q" to be "quit and apply what I told you so far" and "Q" to be "quit and do not apply anything".

> Perhaps "o" (for "stage exactly [o]ne commit"), or "t" for "stage
> [t]his commit" would be reasonable alternatives?

We could also allow multiple commands at once, like "yq" (even in single-key mode, this would do the same thing).

-Peff
Previous: Pete HarlanNext: Michael J Gruber
Message 8 of 15 in “add-interactive: shortcut for add hunk and quit”
  1. add-interactive: shortcut for add hunk and quitHermann Gausterer, May 15, 2011
  2. Junio C HamanoMay 15, 2011
  3. add-interactive: shortcut to add hunk and quitHermann Gausterer, May 16, 2011
  4. Matthieu MoyMay 16, 2011
  5. Junio C HamanoMay 17, 2011
  6. add-interactive: shortcut to add hunk and quitHermann Gausterer, May 17, 2011
  7. Pete HarlanMay 18, 2011
  8. Jeff KingMay 18, 2011
  9. Michael J GruberMay 18, 2011
  10. Junio C HamanoMay 18, 2011
  11. Thomas RastMay 19, 2011
  12. Jeff KingMay 19, 2011
  13. Junio C HamanoMay 19, 2011
  14. Jeff KingMay 19, 2011
  15. Hermann GaustererMay 18, 2011

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.