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

Re: [PATCH v2 0/4] git-gui: Add ability to revert selected hunks and lines

From
David Aguilar <davvid@gmail.com>
Date
Aug 23, 2019, 23:43 UTC
Message-ID
<20190823234339.GA17088@gmail.com>
In-Reply-To
<20190822220107.4153-1-me@yadavpratyush.com>
On Fri, Aug 23, 2019 at 03:31:03AM +0530, Pratyush Yadav wrote:
Show 17 quoted lines
> Hi,
> 
> This series adds the ability to revert selected lines and hunks in
> git-gui. Partially based on the patch by Bert Wesarg [0].
> 
> The commits can be found in the topic branch 'py/revert-hunks-lines'
> at https://github.com/prati0100/git-gui/tree/py/revert-hunks-lines
> 
> Once reviewed, pull the commits from
> 415ce3f8582769d1d454b3796dc6c9c847cefa87 till
> 0a1f4ea92b97e673fda40918dae68deead43bb27, or just munge the patches and
> apply them locally, whichever you prefer.
> 
> Changes in v2:
> - Add an option to disable the revert confirmation prompt as suggested
>   by Johannes Sixt.
> - Base the patches on Pat's git-gui tree instead of git.git.
We've had these features for years in git-cola.

Please copy our keyboard shortcuts. IMO we should not re-invent the user interactions.

http://git-cola.github.io/share/doc/git-cola/hotkeys.html

Ctrl-u is our revert-unstaged-edits hotkeys. "s" is for staging/unstaging (or Ctrl-s if the file list is focused).

The same hotkey is used for operating at the line level. If no lines are selected, the hunk surrounding the current cursor position is used.

Please make keyboard interaction a first-class design consideration.

I have a very strong opinion about the confirmation dialog, so I'll just mention that here since Hannes is on this thread.

In cola we do have a confirmation dialog, and I strongly believe this is the correct behavior because it's an operation that drops data that cannot be recovered.

In the other thread, it was mentioned that this dialog would be a nuisance. Perhaps that is true -- for the dialog that may have been implemented in this series (I haven't run it to verify).

Let's dive into that concern.

In git-cola we have a confirmation dialog and it is by no way a detriment to the workflow, and I use that feature all the time. Why? The reason is that we focused on the keyboard interaction.

The workflow is as follows:
	Ctrl-u to initiate the revert action
	The prompt appears immediately.
		- Hitting any of "enter", "y", or "spacebar" will
		  confirm the confirmation, and proceed.
		- Hitting any of "escape" or "n" will cancel the action.

So essentially the workflow for the power user becomes "ctrl-u, enter" and that is such a tiny overhead that it really is not a bother at all.

On the other hand, if I had to actually move my hand over to a mouse or trackpad and actually "click" on something then I would be super annoyed. That would be simply horrible with RSI in mind.

OTOH having to hit "enter" or "spacebar" (which is the largest key on your keyboard, and your thumbs have good hefty muscles) is totally acceptable in my book because it strikes the right balance between safety for a destructive operation and convenience.

Now, let's consider the alternative -- adding an option to disable the prompt. I don't like that.

Why? It's yet another option. It's yet another thing to document, yet another code path, and yet another pitfall for a user who might run git-gui in a different configuration (and becomes surprised when revert doesn't prompt and suddenly loses their work).

Do we really need an option, or do we need better usability instead? My opinion is that the latter is the real need.

That's my $.02 from having used this feature in practice since 2013.
-- 
David
Previous: Pratyush YadavNext: Bert Wesarg
Message 29 of 49 in “git-gui: Add ability to revert selected hunks and lines”
  1. 0/3 git-gui: Add ability to revert selected hunks and linesPratyush Yadav, Aug 19, 2019
  2. 1/3 git-gui: Move revert confirmation dialog creation to separate functionPratyush Yadav, Aug 19, 2019
  3. 2/3 git-gui: Add the ability to revert selected linesPratyush Yadav, Aug 19, 2019
  4. Johannes SixtAug 20, 2019
  5. Pratyush YadavAug 20, 2019
  6. Johannes SixtAug 20, 2019
  7. Pratyush YadavAug 21, 2019
  8. Johannes SchindelinAug 23, 2019
  9. Junio C HamanoAug 23, 2019
  10. Pratyush YadavAug 23, 2019
  11. Johannes SixtAug 23, 2019
  12. 3/3 git-gui: Add the ability to revert selected hunkPratyush Yadav, Aug 19, 2019
  13. Junio C HamanoAug 20, 2019
  14. Pratyush YadavAug 20, 2019
  15. Bert WesargAug 21, 2019
  16. Pratyush YadavAug 21, 2019
  17. 0/4 git-gui: Add ability to revert selected hunks and linesPratyush Yadav, Aug 22, 2019
  18. 1/4 git-gui: Move revert confirmation dialog creation to separate functionPratyush Yadav, Aug 22, 2019
  19. 2/4 git-gui: Add option to disable the revert confirmation promptPratyush Yadav, Aug 22, 2019
  20. 3/4 git-gui: Add the ability to revert selected linesPratyush Yadav, Aug 22, 2019
  21. Bert WesargAug 23, 2019
  22. Pratyush YadavAug 23, 2019
  23. 4/4 git-gui: Add the ability to revert selected hunkPratyush Yadav, Aug 22, 2019
  24. Junio C HamanoAug 22, 2019
  25. Pratyush YadavAug 22, 2019
  26. Bert WesargAug 23, 2019
  27. Junio C HamanoAug 23, 2019
  28. Pratyush YadavAug 23, 2019
  29. David AguilarAug 23, 2019
  30. Bert WesargAug 24, 2019
  31. Bert WesargAug 24, 2019
  32. David AguilarAug 24, 2019
  33. Johannes SixtAug 24, 2019
  34. 0/4 git-gui: Add ability to revert selected hunks and linesPratyush Yadav, Aug 28, 2019
  35. 1/4 git-gui: allow reverting selected linesPratyush Yadav, Aug 28, 2019
  36. 2/4 git-gui: allow reverting selected hunkPratyush Yadav, Aug 28, 2019
  37. 3/4 git-gui: return early when patch fails to applyPratyush Yadav, Aug 28, 2019
  38. 4/4 git-gui: allow undoing last revertPratyush Yadav, Aug 28, 2019
  39. Bert WesargOct 21, 2019
  40. Pratyush YadavOct 21, 2019
  41. Bert WesargOct 22, 2019
  42. Pratyush YadavOct 23, 2019
  43. Johannes SixtOct 21, 2019
  44. Bert WesargOct 22, 2019
  45. Pratyush YadavOct 23, 2019
  46. Pratyush YadavSep 10, 2019
  47. Johannes SixtSep 10, 2019
  48. Bert WesargSep 12, 2019
  49. Pratyush YadavAug 25, 2019

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.