From: Stephan Beyer <s-beyer@gmx.net>
To: Jeff King <peff@peff.net>, Junio C Hamano <gitster@pobox.com>
Cc: Ariel <asgit@dsgml.com>, git@vger.kernel.org
Subject: Re: git add -p with new file
Date: Mon, 12 Dec 2016 21:31:03 +0100 [thread overview]
Message-ID: <dc698b79-6311-a2a3-c564-a43ef071e62b@gmx.net> (raw)
In-Reply-To: <20161211130034.ygj5l2gbx33uknlk@sigill.intra.peff.net>
Hi,
On 12/11/2016 02:00 PM, Jeff King wrote:
> On Sat, Dec 10, 2016 at 02:04:33PM -0800, Junio C Hamano wrote:
>> Jeff King <peff@peff.net> writes:
>>> On Fri, Dec 09, 2016 at 01:43:24PM -0500, Ariel wrote:
>>> ...
>>>> But it doesn't have to be that way. You could make add -p identical to add
>>>> without options, except the -p prompts to review diffs first.
>>>
>>> The question is whether you would annoy people using "-p" if you started
>>> including untracked files by default. I agree because it's inherently an
>>> interactive process that we can be looser with backwards compatibility.
>>
>> It might be interactive, but it will be irritating that we suddenly
>> have to see hundreds of lines in an untracked file before we are
>> asked to say "no I do not want to add this file" and have to do so
>> for all the untracked files that happen to match the given pathspec.
>>
>> It might make it less irritating if one of the interactive choices
>> offered in the first prompt were N that tells the command: "No,
>> ignore all the untracked paths", though. I dunno.
>
> Yeah, I agree dumping the contents automatically is annoying. Ariel
> suggested asking twice about each path, which sounds clunky to me. I'd
> probably give a simple question, with an option to dump the contents.
> Like:
>
> $ echo foo >untracked
> $ git add -p
> New file: untracked
> Stage this file [y,n,v,q,a,d,/,e,?]? v <-- user types 'v' for "view"
I am also a "git add -p"-only user (except for new files and merges).
However, I usually keep a lot of untracked files in my repositories.
Files that I do not (git)ignore because I want to see them when I type
"git status".
Hence, the imagination only that "git add -p" starts to ask me for each
untracked file feels like a lot of annoying "n" presses. I could imagine
that it is okay-ish when it asks about the untracked files *after* all
tracked paths have been processed (I guess this has been proposed
before), so that I can safely quit.
I am also not really sure what problem this feature is trying to solve.
If the "problem"(?) is that it should act more like "git add" instead of
"git add -u", for whatever reason, this may be fine (but the
configuration option is a must-have then).
For me, I often had the problem that I simply forgot to add new
files...¹ Still I doubt that one would benefit from such a feature
because either:
- you do not have many untracked files (unlike me). You will see the
untracked file (that should be tracked) in the "git status" output when
you edit the commit message², then you abort-add-commit or
commit-add-amend and everything is fine.
Or:
- you have a lot of untracked files (like me). You won't see the
untracked file (that should be tracked) in the "git status" output (you
ignore it because the list is so long) and you won't see it in the "git
add -p" run because you quit before seeing that file.
So I have mixed feelings...
> I'd also probably add interactive.showUntracked to make the whole thing
> optional (but I think it would be OK to default it to on).
Hm, "interactive.showUntracked" is a confusing name because "git add -i"
(interactive) already handles untracked files.
Best
Stephan
¹ I do not have that problem any more because I got used to add new
files right after saving, in a very early state, and then I simply use
"git add -p"...
² Unless you use git commit -m ... But using "git commit -m" without
"git status" before is user-issue anyway.
next prev parent reply other threads:[~2016-12-12 20:31 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-07 1:18 git add -p with new file Ariel
2016-12-07 9:22 ` Duy Nguyen
2016-12-09 18:26 ` Ariel
2016-12-12 20:24 ` Stephan Beyer
2016-12-09 14:11 ` Jeff King
2016-12-09 18:43 ` Ariel
2016-12-10 8:55 ` Jeff King
2016-12-10 22:04 ` Junio C Hamano
2016-12-11 13:00 ` Jeff King
2016-12-12 20:31 ` Stephan Beyer [this message]
2016-12-13 17:33 ` Jeff King
2016-12-13 18:48 ` Junio C Hamano
2016-12-13 18:56 ` Jeff King
2016-12-13 19:12 ` Junio C Hamano
2016-12-13 19:21 ` git add -p with unmerged files (was: git add -p with new file) Stephan Beyer
2016-12-13 19:49 ` Jeff King
2016-12-13 19:59 ` git add -p with unmerged files Junio C Hamano
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=dc698b79-6311-a2a3-c564-a43ef071e62b@gmx.net \
--to=s-beyer@gmx.net \
--cc=asgit@dsgml.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/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