git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josh Triplett <josh@joshtriplett.org>
To: Jeff King <peff@peff.net>
Cc: Junio C Hamano <gitster@pobox.com>,
	Thomas Rast <trast@student.ethz.ch>,
	Jonathan Nieder <jrnieder@gmail.com>,
	git@vger.kernel.org, Wincent Colaiuta <win@wincent.com>
Subject: Re: Please support add -p with a new file, to add only part of the file
Date: Tue, 10 Jan 2012 14:29:26 -0800	[thread overview]
Message-ID: <20120110222926.GB14895@leaf> (raw)
In-Reply-To: <20120110193857.GA19665@sigill.intra.peff.net>

On Tue, Jan 10, 2012 at 02:38:57PM -0500, Jeff King wrote:
> On Tue, Jan 10, 2012 at 11:33:39AM -0800, Junio C Hamano wrote:
> 
> > Jeff King <peff@peff.net> writes:
> > 
> > >> 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.
> > >
> > > I don't think the main impetus for this is that people necessarily want
> > > to pick and choose hunks from added files.
> > 
> > Well, read the subject of your e-mail and tell me what it says ;-)
> 
> Heh. Oops.
> 
> Yes, I agree that "add -p" is not especially useful for that case, and
> the workflow I was describing is very different[1].

I've gotten used to editing diffs directly, and when I just want to
include subsets of a file on a chunk-by-chunk basis (for instance, one
new function but not another new function), I'd find it a lot easier and
less error-prone to "git add -p newfile" and edit a diff than to copy
the file aside, edit the original to delete pieces I don't want, add,
commit, and copy the file back.

Most importantly, I want to use "git add -p" because I know it'll
*never* modify my working copy, only the index.  I find that a useful
safety property.

Apart from that, it also means I have less mental state to track
("remember to copy the original file back later").

- Josh Triplett

      reply	other threads:[~2012-01-10 22:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20120109105134.1239.39047.reportbug@leaf>
2012-01-09 20:47 ` Please support add -p with a new file, to add only part of the file Jonathan Nieder
2012-01-10 14:07   ` Thomas Rast
2012-01-10 18:32     ` Junio C Hamano
2012-01-10 18:38       ` Jeff King
2012-01-10 19:33         ` Junio C Hamano
2012-01-10 19:38           ` Jeff King
2012-01-10 22:29             ` Josh Triplett [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120110222926.GB14895@leaf \
    --to=josh@joshtriplett.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=peff@peff.net \
    --cc=trast@student.ethz.ch \
    --cc=win@wincent.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).