Re: 'commit -a' safety (was: Re: Please default to 'commit -a' when no changes were added)
From: Petr Baudis <hidden>
Date: 2016-06-15 22:48:42
On Sat, Apr 24, 2010 at 06:59:33PM +0200, Wincent Colaiuta wrote:
El 24/04/2010, a las 18:42, Petr Baudis escribió:quoted
Have you ever done this mistake? If you have done some extensive index editing, it is actually a major PITA to restore, and can be even destructive if your index and working tree are too much out-of-sync (this does happen to me not so seldom while I also use -a a lot for trivial commits).Yes I have occasionally committed more than I meant to, but rarely much more, and almost never due to using "git commit -a", seeing as I hardly ever use it. I am of the "commit early and often" school, and my most common pattern is committing tiny batches of changes which I review frequently with "git diff" and then again by staging them with "git add --patch" (aliased as "git patch" seeing as I use it so often).
I also commit early and often, but I just do the review with "git diff" and then commit right away, I guess I don't see much value to do another pass staging everything using "git add -p".
quoted
quoted
IMO, the fact that the commit message editor is populated with a list of changed files that will be included in the commit is enough for people to see what's actually going to happen.BTW, I almost always use -m instead of the commit editor. ;-)Are you not a big fan of "subject line + justification" commit message format? Consider it one of the perks of using the format: your editor will show you a nice summary that gives you yet another chance to double-check what you're about to commit.
I'm a huge fan of "subject line + justification", so I use multiple -m parameters; frequently, for simple changes subject line is enough, in most of the other cases the justification is a one-liner as well, and only in the rest of the cases I defer to the editor. -- Petr "Pasky" Baudis When I feel like exercising, I just lie down until the feeling goes away. -- xed_over