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

Re: Please support add -p with a new file, to add only part of the file

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 10, 2012, 18:32 UTC
Message-ID
<7vpqer9znv.fsf@alter.siamese.dyndns.org>
In-Reply-To
<87ty43fy7f.fsf@thomas.inf.ethz.ch>
Thomas Rast <trast@student.ethz.ch> writes:
> A not-so-proper solution might of course start by looking at which files
> are untracked, and only run the 'git add -N' immediately before patch
> application.

Isn't the real issue that we mistakenly gave an impression that "add -p" is the primary interface to the users, and forgot to tell them about the more general "add -i", which "add -p" is a small subset of?

Even if you start with "add -N", there won't be individual "hunks" you can pick and choose from diffing emptiness and the whole new file, so you end up using "edit hunk" interface.

Whatever you do, you should aim to make it easier to use than
	$ cp newfile.c newfile.c-saved
        $ edit newfile.c ;# delete all the things you do not want for now
        $ git add newfile.c
        $ mv newfile.c-saved newfile.c

Personally, I think it is a very tall order to tweak "add -p / edit" interface to make it easier to use than the above four command sequence, the second one among which is the most time and braincell consuming part of the process, especially when "add -p / edit" gives you has to be unnecessarily distracting by having '+' prefix.

Previous: Thomas RastNext: Jeff King
Message 3 of 7 in “Re: Please support add -p with a new file, to add only part of the file”
  1. Jonathan NiederJan 9, 2012
  2. Thomas RastJan 10, 2012
  3. Junio C HamanoJan 10, 2012
  4. Jeff KingJan 10, 2012
  5. Junio C HamanoJan 10, 2012
  6. Jeff KingJan 10, 2012
  7. Josh TriplettJan 10, 2012

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.