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
GBGoswin von Brederlow <goswin-v-b@web.de>
Date
Apr 23, 2010, 09:03 UTC
Message-ID
<87vdbitu9v.fsf@frosties.localdomain>
In-Reply-To
<alpine.LFD.2.00.1004221651590.7232@xanadu.home>
Nicolas Pitre <nico@fluxnic.net> writes:
Show 20 quoted lines
> On Thu, 22 Apr 2010, Goswin von Brederlow wrote:
>
>> Nicolas Pitre <nico@fluxnic.net> writes:
>> 
>> > On Thu, 22 Apr 2010, Goswin von Brederlow wrote:
>> > Exact.  It is therefore not progress to impose some inconvenience to one 
>> > work flow in order to make another one easier.  And in this case we're 
>> > talking about the difference between having to type an additional -a vs 
>> > the risk of creating a commit with unexpected content.
>> 
>> Is there a risk? You do get an editor with all the files affected listed
>> giving you a big fat warning what you are about to commit. Yes I
>> sometimes do start to commit wrongly too (no matter what RCS used) but
>> then I just close the editor to abort and commit the things seperately.
>
> Yes, but this is a much greater burden to 1) not forget to empty the 
> editor, and 2) actually save the empty file.  Simply exiting the editor 
> will cause unwanted commit.
>
> Compare that with simply adding -a to your commit command when told so.

That is not how it works in other RCS. Initialy the editor only contains comments listing the affected files. If you do not alter the file then the commit aborts. I agree that having to empty the file and save it would be a greater burden.

Show 48 quoted lines
>> >> Alternatively an option to take all changes but only if the index is
>> >> empty would be helpfull. Then people could define an alias for that or
>> >> set the option in the config. Other than setting -a that would allow
>> >> using an index when needed and commit everything in the normal case
>> >> without having to change the command used to commit.
>> >
>> > But you're proposing to change the semantics for that command.  And I 
>> > also suspect that you're trying to make the index more hidden while what 
>> > we're actually trying to do is to promote it.
>> 
>> Yes, it would hide the index. But you are not just promoting it. You are
>> forcing people to always use it, even if only through the -a option.
>
> Well, sure.
>
> And you might be glad that the -a option is there at all.  When this was 
> debated, the concensus was that the index is what makes Git so 
> different, and actually *better* than the alternatives.
>
> Concerns were raised about natural human resistance to change and the 
> fact that some people would have problem adapting to a different model.  
> So the -a argument was added as a compromize, although the concensus was 
> much less strong in that case.
>
> And experience so far has shown that the vast majority of new Git users 
> started to really appreciate the index once they've past the initial 
> hurdle of getting used to a different concept.
>
> So we can say that Git's index is one of its major feature.  You should 
> learn to use it or stick to -a, but please don't try to make Git into 
> what it was meant to be different from.
>
>> > What _you_ can do though, is this:
>> >
>> > 	git config --global alias.ci "commit -a"
>> 
>> But then when I accidentally use 'git ci' while having an index the
>> index gets ignored and all changed files get commited in one big mess.
>
> Not at all.  You will end up in the same text editor with the same 
> opportunity to abort the messed up commit as you are claiming above.  
> Except now this is your own burden instead of mine.  See?  One's gain is 
> another one's loss.
>
> However in this case this would happen because you mixed up an 
> index-using workflow with a non-index-using workflow.  While with your 
> suggested change the messed up commit could occur without mixing up 
> workflows.

No, with my suggested change (either change of the default or the extra option) it would be smart enough to do the right thing on its own.

Show 13 quoted lines
> So either you use the index or you don't.  And of course I'd strongly 
> suggest you truly consider using it.
>
>> Given how seldom I need an index (so far never) the risk of using 'git
>> ci' accidentally is way to high. Same with typing -a. I do it so often
>> that when I actualy don't want it I will probably type it anyway out of
>> habbit.
>
> This is a strawman.  If you do not use the index and never used it so 
> far, why are you so afraid of this ci alias?  Please get over it.
>
>
> Nicolas

You all say the index is such a great thing. So I might use it eventually. Other people might use it 1 out of 10 times. Yet other people use it 9 out of 10 times. Can you at least accept that the use of the index feature is different for each person?

My suggested change, with the --a-if-empty option, would not impose anything on existing usage. But it would benefit those that rarely use an index and would like git to be smart enough to know when to use the index and when not. Yes, it would mean the use of the index ideology is not force upon people anymore. But isn't that a good thing? Free software is about freedom. That should include the freedom not to use the index method.

MfG
        Goswin
Previous: Nicolas PitreNext: Miles Bader
Message 7 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.