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

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

From
Junio C Hamano <gitster@pobox.com>
Date
May 18, 2011, 15:28 UTC
Message-ID
<7vr57wc9ja.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4DD390AF.9020705@drmicha.warpmail.net>
Michael J Gruber <git@drmicha.warpmail.net> writes:
Show 15 quoted lines
>> We could also allow multiple commands at once, like "yq" (even in
>> single-key mode, this would do the same thing).
>
> So instead of having to
>
> press y press q
>
> I can now
>
> hold SHIFT press q
>
> Seeing the gain in that fails me completely. Also, why doesn't "yd"
> deserve a shortcut? I would expect that to be used more often, as in:
> "Yes, that was the hunk I wanted to add from this file, but what other
> files have changes"?

Thanks, I agree that "Q" as proposed is not very useful and looks too much like a hack that caters to one special user from that point of view.

I've also been wondering why nobody has asked for "5y", which I often find lacking.

When you have a set of changes with many hunks to sift through, before going into an "add -p" session, you often have pretty good idea of hunks in which part of the files are to go to the commit you are currently building. I often find myself saying "ah, from here there are many hunks I want, and it is totally safe for me to apply 5 or so from here without looking."

I think "single-key" was a poorly designed attempt to improve productivity the ("y" <RET>)*5 into "y"*5, while sacrificing the safety net when you are trying to pick and decide one by one (like the accident Thomas had recently during "checkout -p"). If I can say "5y", think for half a second to make sure I typed what I meant, and <RET>, to apply 5 upcoming hunks in one go, I think I would be as efficient as the productivity optimization the single-key offers, while still protecting me from mistakes made by fat fingers.

Previous: Michael J GruberNext: Thomas Rast
Message 10 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.