Re: [RFC/PATCH] git add: notice removal of tracked paths by default
- From
Michael J Gruber <git@drmicha.warpmail.net>
- Date
- Apr 20, 2011, 08:18 UTC
- Message-ID
- <4DAE96C7.9070904@drmicha.warpmail.net>
- In-Reply-To
- <20110420055758.GC28597@sigill.intra.peff.net>
Jeff King venit, vidit, dixit 20.04.2011 07:57:
Show 36 quoted lines
> On Tue, Apr 19, 2011 at 12:18:20PM -0700, Junio C Hamano wrote:
>
>> Make "git add" to pretend as if "-A" is given when there is a pathspec on
>> the command line. "git add" without any argument continues to be a no-op.
>
> I like your proposed semantics much better. I remember many times early
> on with git cursing the current behavior, until I finally trained myself
> to do "git add -A".
>
>> This might not be such a good idea, and I do not have a strong opinion
>> for this change, but merely a weatherbaloon.
>>
>> Having "git add ." notice removals might lead to mistakes ("oh, I only
>> meant to record additions, and didn't want to record the removals"), but
>> at the same time, leaving it not notice removals would lead to mistakes
>> by the other people ("I added, removed and edited different paths, but
>> why only removals are ignored?").
>
> I suspect most people will want the new semantics, because no matter
> what your overall workflow, it is generally going to be some variant of:
>
> 1. hack hack hack
> 2. tell git about changes
>
> And you don't really care about deletions versus modifications, you just
> want them all added. But you probably _do_ care about additions versus
> modififications, since step 1 often involves creating cruft that should
> remain untracked (whereas it very rarely involves _deleting_ precious
> files). And that's why we have "add -u", which should not go away.
>
> My biggest worry would be people saying "eh? Add removes my files? That
> makes no sense!" But we more or less already have that with "add -u",
> and I think people have learned to accept that it is about "add the
> current state to the index" and not "add files to git".
>
> -PeffYes, that behaviour makes much more sense.
That means that "git add -A" is "git add ." and "-A" is not needed otherwise any more, right? makes sense, too, and we could probably deprecate (i.e. stop advertising) it.
Michael