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
Linus Torvalds <torvalds@osdl.org>
Date
Nov 30, 2006, 19:55 UTC
Message-ID
<Pine.LNX.4.64.0611301132350.3513@woody.osdl.org>
In-Reply-To
<87hcwgu5t1.wl%cworth@cworth.org>
On Thu, 30 Nov 2006, Carl Worth wrote:
Show 6 quoted lines
> 
> If the "create file; git add; edit file; git commit" confusion isn't
> blisteringly obvious to the git maintainers then I think I have to
> give up here.
> 
> And this isn't just CVS-induced brain damage.
I'm sorry, but you are wrong.

It really _is_ CVS-induced brain damage, and I'm trying to teach you. You can give up, but that's really "refuse to see the damage that systems like RCS and CVS has done to the world"

The fundamental brain damage that CVS (and RCS, and SVN, and just about anything else) has had is thinking that "filenames" (and sometimes this is "fixed" to be "file ID's") are somehow special, and a totally separate thing from "file contents".

Really. It's a BUG. It's a deficiency in CVS and friends. And it's a deficiency that you have gotten so used to that you don't even see that it's simply obviously NOT TRUE.

You _cannot_ have a filename without the contents of that filename. That whole concept doesn't make sense, except in the twisted AND WRONG mental model of "files have identities even without content".

The whole point of git is that it is about "project state" and the history that binds those states together. People have kind of come to accept that, and a lot of people realize what it means, but I don't think you've really accepted what it means for something as simple as a "git add" command.

Again, totally ignore the index. Imagine that it doesn't exist. Imagine that you never actually learnt about it, and that none of the documentation ever mentions it, and just ask yourself:

	"What does 'adding a file' really mean?"

I mean _really_. It cannot be about the "filename", because a filename simply doesn't have any meaning alone. Remember what git is all about.

No, when you do a "git add", YOU DO NOT TALK ABOUT FILENAMES AT ALL.
	NOT EVEN CLOSE!

No. Git is, and has always been, all about tracking project content. The fact that CVS is crap, and thinks that "filenames" are special (and this causes major problems when you do renames), and the fact that SVN is crap, and things that "file identities" are special (and this causes major problems when you split a file or when two files join) is very much about THEIR F*CKING IDIOTIC FUNDAMENTAL BRAINDAMAGE!

So take five minutes to really think about that. Take an hour. Take a week. Ponder it.

What does it mean to "add" something to a project? It has _nothing_ to do with "filenames". Yeah, the filename obviously exists, but it's not something that exists on its own. You add the ONLY thing that git tracks.

You add CONTENT.

When you do "git add file.c" you aren't adding a filename to the list of files that git knows about. Not even CLOSE. No. You are really adding _content_ to the project you are tracking. You haven't bound it to a commit yet, but it's there. It's there both conceptually, and very much in a real technical sense too (you've literally added the git object that that file describes to the object database - the "commit" and "tree" objects to tie it all together is just waiting to be added, but they really just expose it - the actual file object has already been created when you do "git add".)

So yes, you very much ARE talking about CVS braindamage. The reason why
	git add file.c
	echo New line >> file.c
	git commit

commits the _old_ content, is very much because git is ALL ABOUT THE CONTENT. It has _never_ been about filenames. And it _shouldn't_ be about filenames, because that would be BUGGY AND BROKEN.

Sorry for shouting, but as long as you think "git add" adds a filename, you're just not getting it. And I think it's really sad that you don't even seem to understand that yes, this _is_ braindamage that has been forced upon you by decades of mental rape done by bad source control systems.

Please. File identities are _bad_ in the SVN kind of setting. The CVS kind of "filename == file identity" is even _worse_, but it's still exactly the same disease. It's the disease of thinking that metadata is somehow "different" from real data, and that "files" have identities that are somehow separate from the data they contain.

Face it, git is consistent, and if it acted the way you seem to expect it to act, it would actually be a BUG. Exactly because you cannot and MUST NOT think that "filename" is something that has meaning without "file content" (or "file type" and "file permissions" - they all go together).

And notice? NONE OF THIS HAS ANYTHING AT ALL TO DO WITH 'INDEX'!! The explanation above is not "this is how the index works". It's a much more fundamnetal issue of getting the right mental model, where the only thing that matters is contents.

So even without an index, "git add" should work the way it works, once you can just let go of the broken model that is CVS.

Please. Join me, Luke. The power of the git side is stronger. I am your father.

Previous: Carl WorthNext: Nicolas Pitre
Message 35 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.