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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 18, 2012 at 04:10:34PM -0600, Evan Driscoll wrote:

> I have two use cases of 'add -i'. The more common one is if I kind of
> want -p but don't want to do it for every file. (I guess in part this is
> my way of substituting for not knowing all the actions during -p as
> well.) But I sometimes use it if I want to stage several but not all
> files, as it's often faster for me to just choose the files I want from
> the interactive add's list than it is for me to type each of the files
> that I want (even with tab completion) -- I'm often working in a project
> with unfortunately-deep paths.
> 
> What I want for my 'discard' action is more like the latter: I'd like a
> fast way to choose a file(s) to discard without having to type the path(s).

That makes sense.

> Maybe I should just investigate tig or another front end; that might
> satisfy my desire.

Yes, "tig status" will do this (use "!" to revert changes to the path).

Another trick is to stage what you want and throw away the rest, like:

  $ hack hack hack
  $ git add -i ;# now everything unstaged is garbage
  $ git checkout .
  $ test test test
  $ git commit

Of course that implies that you can separate the wheat from the chaff at
that exact moment. Sometimes you are just discarding known junk to make
further work or "add -i" easier.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]