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

Re: [PATCH 0/2] Making "git commit" to mean "git commit -a".

From
Junio C Hamano <junkio@cox.net>
Date
Nov 30, 2006, 01:03 UTC
Message-ID
<7vodqpn3t4.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<87ejrlvn7r.wl%cworth@cworth.org>
Carl Worth <cworth@cworth.org> writes:
Show 5 quoted lines
> I think what I'm asking for is a much more mild change. The "keep the
> index clean" behavior exists almost everywhere already, (the few
> exceptions are things like "git cherry-pick -n", and the notable
> exception of a conflicted merge). So I don't think supporting "commit
> -a by default" means we have to introduce a large conceptual change.

We seem to be agreeing (and Linus seems to, too, in a thread next door) that it is a good thing that git keeps index clean unless you explicitly ask it to.

We also seem to be agreeing that people with more involved needs can deliberately make index different from HEAD, way before issuing "git commit", and that they can commit even when "git diff" gives nonempty differences, and these are good things.

Are we on the same page?

Now what does it mean to make "commit" silently update the index with all the changes in the working tree without being told?

Unless you are introducing "working tree is the king" mode to git to make everything ignore the index's "contents" part (in other words, the index is used as the CVS/Entries file, nothing more, under that mode of operation), I think you just introduced an inconsistency at the place where the difference matters most.

I do not agree what you are asking is a "mild change" at all, and I said it already that it goes against the mental model of how git tools work.

Earlier, the world model was "you build it in the index and you make a commit of what is in the index; there is a last-minute index operation you can do by passing paths to commit and as a short-hand there is -a as well [*1*]". Now you made the world model "it does not matter what you have in the index before issuing git-commit; if you want to preserve what you built in the index, you have to do something non-default". That WOULD solicit more newbie confusion. "If it does not matter at the end unless you do something special, why bother doing it at all?" would be the question you would face.

Earlier on the "UI warts" thread, people said that the users do not form the mental model of how the toolset works by reading the tool's documentation but by trying things out, and I think that is a valid observation. We should not be sending a wrong message by introducing inconsistencies like that.

The tool's UI should naturally reflect what world model it is based on, and like it or not, the world model of git includes the index. The way to explain "-a" to new users should not be "you can _ignore_ index as long as you use -a". I do not think denying the index buys the new users anything. Rather, "building your next commit incrementally in the index is the workflow git is designed to support, but you are not required to do that _incrementally_. Until you encounter a complex situation such as resolving a large conflicting merge, doing that incrementally does not buy you anything as long as you work in a clean working tree. Instead, you can tell git what you want to commit when you run 'git-commit' by giving paths or directory names, or if you want to commit everything in the working tree, then you can also say '-a'".

I am all for rewording the cryptic "use update-index to update" message with "use 'commit -a' to commit all of them" or somesuch. That does NOT break the mental model.

Another thing that we need to be aware of is that new users won't be "newbies" forever, and the tool should not be optimized for the first few pages of the tutorial. You and Nico say "experienced people can always alias UI warts away", but I think that is a wrong attitude. Users with experience, long after this discussion is forgotten, would complain "other tools help us build the next commit in the index, but git-commit by default discards the distinction between what were marked for commit and what were not, unless explicitly told not to. Why does it do -a by default, and why should I forced to alias that stupid default away?"

[Footnote]

*1* In retrospect, making "commit -o" the default was a very bad change; I got tired of repeating myself in that discussion and applied that change, but it was probably a mistake.

Previous: Johannes SchindelinNext: Junio C Hamano
Message 16 of 76 in “Re: [PATCH 0/2] Making "git commit" to mean "git commit -a".”
  1. Junio C HamanoNov 29, 2006
  2. Nicolas PitreNov 29, 2006
  3. Junio C HamanoNov 29, 2006
  4. Nicolas PitreNov 29, 2006
  5. Jakub NarebskiNov 29, 2006
  6. Steven GrimmNov 29, 2006
  7. Jakub NarebskiNov 29, 2006
  8. Junio C HamanoNov 29, 2006
  9. Steven GrimmNov 29, 2006
  10. Johannes SchindelinNov 29, 2006
  11. Junio C HamanoNov 29, 2006
  12. xdl_merge(), was Re: [PATCH 0/2] Making "git commit" to mean "git commit -a".Johannes Schindelin, Nov 29, 2006
  13. Seth FalconNov 30, 2006
  14. Carl WorthNov 29, 2006
  15. Johannes SchindelinNov 29, 2006
  16. Junio C HamanoNov 30, 2006
  17. Junio C HamanoNov 30, 2006
  18. Steven GrimmNov 30, 2006
  19. Sam VilainNov 30, 2006
  20. Junio C HamanoNov 30, 2006
  21. Johannes SchindelinNov 30, 2006
  22. Linus TorvaldsNov 30, 2006
  23. Johannes SchindelinNov 30, 2006
  24. Andreas EricssonNov 30, 2006
  25. Linus TorvaldsNov 30, 2006
  26. Theodore TsoNov 30, 2006
  27. Linus TorvaldsNov 30, 2006
  28. Nicolas PitreNov 30, 2006
  29. Carl WorthNov 30, 2006
  30. Jakub NarebskiNov 30, 2006
  31. Carl WorthNov 30, 2006
  32. Andreas EricssonDec 1, 2006
  33. Han-Wen NienhuysDec 1, 2006
  34. Carl WorthNov 30, 2006
  35. Linus TorvaldsNov 30, 2006
  36. Nicolas PitreNov 30, 2006
  37. Linus TorvaldsNov 30, 2006
  38. Jakub NarebskiNov 30, 2006
  39. Carl WorthNov 30, 2006
  40. Michael K. EdwardsNov 30, 2006
  41. Carl WorthNov 30, 2006
  42. Jakub NarebskiNov 30, 2006
  43. Johannes SchindelinNov 30, 2006
  44. Josef WeidendorferNov 30, 2006
  45. Johannes SchindelinNov 30, 2006
  46. Nicolas PitreNov 30, 2006
  47. Nicolas PitreNov 30, 2006
  48. Junio C HamanoNov 30, 2006
  49. Andy ParkinsDec 1, 2006
  50. Alan ChandlerDec 1, 2006
  51. Junio C HamanoNov 30, 2006
  52. Nicolas PitreNov 30, 2006
  53. Junio C HamanoNov 30, 2006
  54. Linus TorvaldsNov 30, 2006
  55. Carl WorthDec 1, 2006
  56. Linus TorvaldsDec 1, 2006
  57. Carl WorthDec 1, 2006
  58. Linus TorvaldsDec 1, 2006
  59. Carl WorthDec 1, 2006
  60. Linus TorvaldsDec 1, 2006
  61. Carl WorthDec 1, 2006
  62. Michael K. EdwardsDec 1, 2006
  63. Junio C HamanoDec 1, 2006
  64. Jakub NarebskiDec 1, 2006
  65. Nicolas PitreDec 1, 2006
  66. Andreas EricssonDec 1, 2006
  67. Alan ChandlerDec 1, 2006
  68. Robert ShearmanNov 30, 2006
  69. Jakub NarebskiNov 30, 2006
  70. Shawn PearceDec 1, 2006
  71. Marco CostalbaDec 2, 2006
  72. Carl WorthNov 30, 2006
  73. Linus TorvaldsNov 30, 2006
  74. Daniel BarkalowNov 30, 2006
  75. Nicolas PitreNov 30, 2006
  76. Johannes SchindelinNov 30, 2006

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.