Re: Change behavior of git add --patch on newly added file?
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 9, 2019, 07:14 UTC
- Message-ID
- <xmqqpni1ldw2.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <xmqq5zjtn07v.fsf@gitster-ct.c.googlers.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 7 quoted lines
> Emily Shaffer <emilyshaffer@google.com> writes: > >> Should 'git add -p <newly-added-file>' do the same thing as 'git add -N >> <newly-added-file && git add -p <newly-added-file>'? > ... > Patches welcome, but you may want to check with Dscho as there is an > effort going on to reimplement the entire "add -i" machinery in C.
Oh, having said all that, for a newly added file, all you have is a hunk that is full of added lines and nothing else, so even 's'plit interactive subcommand of "add -p" interface would not do anything.
So I am not sure if performing an implicit "add -N" upfront would help your use case that much. For that, you'd need to extend hunk splitting UI a bit more, so that the user can split a hunk that only adds lines into two at a desired point in the hunk.