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

Re: Feature suggestion: new 'git add -i' command to discard working copy changes

From
Jeff King <peff@peff.net>
Date
Dec 18, 2012, 21:59 UTC
Message-ID
<20121218215914.GB1806@sigill.intra.peff.net>
In-Reply-To
<7vvcbzdoy9.fsf@alter.siamese.dyndns.org>
On Tue, Dec 18, 2012 at 01:34:38PM -0800, Junio C Hamano wrote:
Show 15 quoted lines
> Evan Driscoll <driscoll@cs.wisc.edu> writes:
> 
> > It's not infrequent that I want to discard changes I've made locally to
> > files ('git checkout file.txt') and find myself wishing that this was an
> > action available from the 'git add --interactive' UI; it feels like it
> > would fit in.
> 
> Hrm, not really.  "git add" is about manipulating the index and its
> promise is that it won't touch working tree files.  And people rely
> on that promise.
> 
> I can see how it would be useful to have a UI that is more
> interactive than CLI that shows you a list of paths and lets you
> pick from the list to run "git checkout" on, but I think "git add"
> is a bad match to it.

Yeah. We already generalized "git add -p" to "git checkout -p" (and "reset -p", etc) to do hunk selection. Nobody bothered to generalize the rest of "git add --interactive", but logically having "git checkout --interactive" (and "git reset --interactive") would make sense.

I always assumed nobody really used the full "add -i", but maybe it is because I am such a command-line snob. Evan, are you after hunk selection (like choosing "patch" from the interactive UI), or full path selection?

-Peff
Previous: Junio C HamanoNext: Evan Driscoll
Message 3 of 5 in “Feature suggestion: new 'git add -i' command to discard working copy changes”
  1. Evan DriscollDec 18, 2012
  2. Junio C HamanoDec 18, 2012
  3. Jeff KingDec 18, 2012
  4. Evan DriscollDec 18, 2012
  5. Jeff KingDec 18, 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.