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

Re: [PATCHv2 3/3] git-add: rename -u to -a

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Feb 28, 2011, 09:49 UTC
Message-ID
<4D6B6F97.8030409@drmicha.warpmail.net>
In-Reply-To
<vpqwrkkpkea.fsf@bauges.imag.fr>
Matthieu Moy venit, vidit, dixit 28.02.2011 10:40:
Show 31 quoted lines
> Michael J Gruber <git@drmicha.warpmail.net> writes:
> 
>> But just how useful is our default that "git add" is a no-op?
> 
> I dont care very much myself, but if you consider "git add ." as a
> potentially destructive operation (discards changes that may be precious
> in the index), then it's good that "git add" is a no-op.
> 
> Many beginners will try commands expecting to get a help message or a
> hint on how to use it when ran without argument (principle of least
> surprise)
> 
> Like:
> 
> $ ls
> file1 file2
> => oh, so "ls" lists files.
> $ rm
> rm: missing operand
> Try `rm --help' for more information.
> => ok, so rm needs more operands
> 
> A user typing "git add" just "to see what happens" may be disapointed to
> have all its files added. In particular since "git add" is silent by
> default, hence
> 
> # let's see what happens ...
> $ git add
> $ 
> # ok, nothing happened ...
> # continue hacking without noticing that a bunch of files have been added.
No no, I said "add" would default to what "-u" does now (see below).
A user "starting to experiment with add" while have nothing in the index.
> Mercurial has taken the other way, making "hg add" add everything by
> default, and some users do complain:
> 
> http://osdir.com/ml/version-control.mercurial.general/2007-08/msg00316.html
Since when do we care about them (as in "hg", not in "users", mind you...).
> If you change this for Git, you'll have people complaining about
> backward compatibility plus people complaining about least surprise :-(
> 
>> - "add" should be about tracked paths by default (default pathspec "."),
See, here!
Show 9 quoted lines
>>
>> - "commit -a,--add <addopts>" be "add <addopts> && commit", and
>>
>> - "-A,--all pathspec" (default pathspec ".") be about tracked and
>> untracked paths (whether add or commit).
> 
> Today, "git add ." adds new content in tracked files, and new files, but
> doesn't notice files deletions. Did I miss something, or is there no way
> to do that with your proposal?
What in
> That would need a proper migration
> plan etc., and some thinking about -i/-o. Just brain-storming.
reads "proposal" to you?

Besides, current "git add ." is a really strange thing, doing more and less than "git add -u", mixing "update" with "track", but not completely. What is it even good for? ;)

(We could have an option for that, of course. Have I mentioned "radical"?)
Michael
Previous: Matthieu MoyNext: Tor Arntsen
Message 25 of 30 in “add/commit -u/-a/-A”
  1. 0/3 add/commit -u/-a/-AMichael J Gruber, Feb 25, 2011
  2. 1/3 git-add: make -A description clearer vs. -uMichael J Gruber, Feb 25, 2011
  3. Junio C HamanoFeb 25, 2011
  4. 2/3 git-commit: rename --all to --trackMichael J Gruber, Feb 25, 2011
  5. Junio C HamanoFeb 25, 2011
  6. 3/3 git-add: rename -u to -aMichael J Gruber, Feb 25, 2011
  7. Junio C HamanoFeb 25, 2011
  8. Michael J GruberFeb 26, 2011
  9. 0/3 add/commit -u/-a/-AMichael J Gruber, Feb 27, 2011
  10. 1/3 git-add: make -A description clearer vs. -uMichael J Gruber, Feb 27, 2011
  11. Junio C HamanoFeb 27, 2011
  12. 2/3 git-commit: rename --all to --all-trackedMichael J Gruber, Feb 27, 2011
  13. 3/3 git-add: rename -u to -aMichael J Gruber, Feb 27, 2011
  14. Nguyen Thai Ngoc DuyFeb 27, 2011
  15. Junio C HamanoFeb 28, 2011
  16. Michael J GruberFeb 28, 2011
  17. Miles BaderFeb 28, 2011
  18. Michael J GruberFeb 28, 2011
  19. Miles BaderFeb 28, 2011
  20. Snipping on this list (Was: Re: [PATCHv2 3/3] git-add: rename -u to -a)Michael J Gruber, Feb 28, 2011
  21. Junio C HamanoFeb 28, 2011
  22. Miles BaderFeb 28, 2011
  23. Michael J GruberFeb 28, 2011
  24. Matthieu MoyFeb 28, 2011
  25. Michael J GruberFeb 28, 2011
  26. Tor ArntsenFeb 28, 2011
  27. Michael J GruberFeb 28, 2011
  28. Matthieu MoyFeb 28, 2011
  29. Michael J GruberFeb 28, 2011
  30. Junio C HamanoFeb 28, 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.