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

more novice-friendly behaviour of `git add -p`

From
Eenrico <enrico.guiraud@gmail.com>
Date
May 20, 2016, 13:06 UTC
Message-ID
<loom.20160520T150517-391@post.gmane.org>

Hello all, I have encountered a couple of non-necessary difficulties when editing a patch during a `git add -p`.

Firstly, the help message says "To remove '-' lines, make them ' ' lines (context)." which is a bit confusing because that "them" refers to '-', not to 'lines'. I spent a good half hour changing '-' lines to lines containing a single white space but git was not very happy about it. I would suggest to change that line with "To remove '-' lines, change '-' into ' ' (for context)"

Secondly, as discussed here (http://git.661346.n2.nabble.com/git-add-patch-bug-with-split-edit-td2171634.html) and in numerous stackoverflow questions, the behaviour of the "edit" (e) option during an interactive add is a bit...bizarre: it requires the user to do a lot of gymnastic if (s)he is editing a hunk after having used the split (s) option, and nine times out of ten the patch will not apply cleanly. I would suggest to change the behaviour of the interactive add to only allow edits when the hunk has not been split (possibly with a one-line explanation for why editing is not possible appearing when inside a split hunk). Since editing is more powerful than splitting this would not result in a loss of generality, but, in my humble opinion, in a much nicer experience for novices and experts alike.

Best regards, enrico

Next: Junio C Hamano
Message 1 of 3 in “more novice-friendly behaviour of `git add -p`”
  1. enricoMay 20, 2016
  2. Junio C HamanoMay 20, 2016
  3. enricoMay 20, 2016

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.