git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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".
> 
> -Peff
Yes, 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
Previous: Jeff King
Message 6 of 6 in “git add: notice removal of tracked paths by default”
  1. git add: notice removal of tracked paths by defaultJunio C Hamano, Apr 19, 2011
  2. Sverre RabbelierApr 19, 2011
  3. Junio C HamanoApr 19, 2011
  4. Sverre RabbelierApr 19, 2011
  5. Jeff KingApr 20, 2011
  6. Michael J GruberApr 20, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.