Re: non-empty index with git commit -a
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:50:34
Sverre Rabbelier [off-list ref] writes:
On Wed, Feb 16, 2011 at 08:51, Jeff King [off-list ref] wrote:quoted
I can just as easily run "git add -u", or "git add -p" on top of some changes and then realize afterwards that I actually wanted the previous index state.I disagree, those are all index manipulation tools, `git commit -a` is not.
"git commmit" is not an index-manipulation tool. Giving "-a" or pathspec to the command however is. Having said that, exactly because "commit" _feels_ more like a point-of-no-return than a mistaken second "add" to the end user (even though it is not technically different), I think it is Ok to add a configuration that makes the command bail out when "-a" is given and there are changes to the index. I don't think it is sane to trigger the same safety when a pathspec is given, though.