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

Re: Please default to 'commit -a' when no changes were added

From
TATor Arntsen <tor@spacetec.no>
Date
Apr 23, 2010, 09:35 UTC
Message-ID
<p2qd2d39d861004230235tacb970bftc96f2c1473843b1c@mail.gmail.com>
In-Reply-To
<87r5m6tu0l.fsf@frosties.localdomain>
On Fri, Apr 23, 2010 at 11:09, Goswin von Brederlow <goswin-v-b@web.de> wrote:
Show 11 quoted lines
> For SVN users it gets much worse:
>
> vi existing-file.c # do some changes
> vi new-file.c      # create the file
> git add new-file.c
> vi new-file.c      # do some more changes
> git commit
>
> A SVN user would expect the current working copies of existing-file.c
> and new-file.c to be commited. Instead only new-file.c is commited and
> only the fist modification.
I come from CVS, i.e. a similar background.
> While this case is still highly confusing to non git users I do see that
> it can't be easily changed. And my suggestion doesn't change it. The
> call to "git add" creates an index so the commit would only act on the
> index.

I wouldn't agree it's highly confusing. As soon as you understand why (and it shouldn't take long), it's a relief. With CVS I would constantly make copies of my working tree so that I could sort out all the different things I was working on at the same time (which is a necessity when you work with development and bugfixing and customer reports with different priorities are dropping in). It's much easier now (with Git) to do a couple of different things at the same time.

Besides, I would argue that the SVN/CVS behaviour is creating problems also for SVN/CVS users. Where I work it's not unusual that developers accidentally commit different changes in the same commit, making it hard to extract the one you want when you later wish to e.g. push a specific change to a maintenance branch or hotfix tree.

And git add --patch is also wonderful sometimes. (Unfortunately that won't work on systems with pre-5.8 versions of Perl, which I just found out - but that's another story.)

I plan to create a short course for my fellow co-workers when we move more stuff over from CVS to Git. Just an hour should do I think. I'll clarify how the index works very early on and I believe they'll all "get it" very quickly. I'll probably also take some parts from 'Git from the bottom up' by John Wiegley, at least I found (after having used Git for some time) that knowing how it works from blobs and up actually helps a lot.

I won't join in on the discussion of any actual changes to Git, for that I'm too fresh as Git user. I would only like to stress that I wouldn't want the current flexibility to get limited or changed to be more like SVN/CVS -- I come from there, remember, and I don't see why I would wish to go back.

-Tor
Previous: Matthieu MoyNext: Adam Brewster
Message 29 of 76 in “Re: Please default to 'commit -a' when no changes were added”
  1. Jonathan NiederApr 22, 2010
  2. Goswin von BrederlowApr 22, 2010
  3. Nicolas PitreApr 22, 2010
  4. Sverre RabbelierApr 22, 2010
  5. Goswin von BrederlowApr 22, 2010
  6. Nicolas PitreApr 22, 2010
  7. Goswin von BrederlowApr 23, 2010
  8. Miles BaderApr 23, 2010
  9. Wincent ColaiutaApr 23, 2010
  10. Goswin von BrederlowApr 23, 2010
  11. Michael WittenApr 23, 2010
  12. Daniel GraceApr 23, 2010
  13. Nicolas PitreApr 23, 2010
  14. Goswin von BrederlowApr 24, 2010
  15. Jonathan NiederApr 24, 2010
  16. Goswin von BrederlowApr 24, 2010
  17. Jonathan NiederApr 24, 2010
  18. Miles BaderApr 25, 2010
  19. Jonathan NiederApr 25, 2010
  20. Matthias AndreeApr 23, 2010
  21. Junio C HamanoApr 24, 2010
  22. Junio C HamanoApr 22, 2010
  23. Matthieu MoyApr 22, 2010
  24. Michael WittenApr 22, 2010
  25. Goswin von BrederlowApr 23, 2010
  26. Tomas CarneckyApr 23, 2010
  27. Michael WittenApr 23, 2010
  28. Matthieu MoyApr 23, 2010
  29. Tor ArntsenApr 23, 2010
  30. Adam BrewsterApr 22, 2010
  31. Jonathan NiederApr 22, 2010
  32. Goswin von BrederlowApr 23, 2010
  33. The index (Re: Please default to 'commit -a' when no changes were added)Jonathan Nieder, Apr 23, 2010
  34. Jon SeymourApr 22, 2010
  35. Adam BrewsterApr 23, 2010
  36. Goswin von BrederlowApr 23, 2010
  37. Goswin von BrederlowApr 23, 2010
  38. Björn SteinbrinkApr 23, 2010
  39. Sergei OrganovApr 23, 2010
  40. Sverre RabbelierApr 23, 2010
  41. Sergei OrganovApr 23, 2010
  42. Goswin von BrederlowApr 23, 2010
  43. Matthias AndreeApr 23, 2010
  44. Michael WittenApr 23, 2010
  45. Matthias AndreeApr 23, 2010
  46. Eric RaymondApr 23, 2010
  47. Michael WittenApr 23, 2010
  48. Eric RaymondApr 24, 2010
  49. Michael WittenApr 24, 2010
  50. Eric RaymondApr 24, 2010
  51. Michael WittenApr 23, 2010
  52. Tor ArntsenApr 24, 2010
  53. 'commit -a' safety (was: Re: Please default to 'commit -a' when no changes were added)Jakub Narebski, Apr 24, 2010
  54. Miles BaderApr 24, 2010
  55. Andreas SchwabApr 24, 2010
  56. Jakub NarebskiApr 24, 2010
  57. Miles BaderApr 24, 2010
  58. Nicolas PitreApr 24, 2010
  59. Jakub NarebskiApr 25, 2010
  60. Miles BaderApr 25, 2010
  61. Wincent ColaiutaApr 24, 2010
  62. Jakub NarebskiApr 24, 2010
  63. Joey HessApr 24, 2010
  64. Mike HommeyApr 24, 2010
  65. Petr BaudisApr 24, 2010
  66. Bug#578764: 'commit -a' safety (was: Re: Please default to 'commit -a' when no changes were added)Wincent Colaiuta, Apr 24, 2010
  67. Petr BaudisApr 24, 2010
  68. Nicolas PitreApr 24, 2010
  69. Petr BaudisApr 24, 2010
  70. Nicolas PitreApr 24, 2010
  71. Jacob HelwigApr 24, 2010
  72. Nicolas PitreApr 24, 2010
  73. Jacob HelwigApr 24, 2010
  74. Jakub NarebskiApr 24, 2010
  75. Junio C HamanoApr 25, 2010
  76. Jakub NarebskiApr 25, 2010

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.