From: Junio C Hamano Date: Wed, 01 Feb 2006 21:59:32 GMT Subject: Re: [Census] So who uses git? Message-ID: <7v8xsu91vf.fsf@assigned-by-dhcp.cox.net> In-Reply-To: Linus Torvalds writes: >> - "git commit" means: update index with all local changes and >> then commit the tree described in index (current "-a" >> behaviour). > > No. Please no. "git commit" should continue to do what it does now. > Otherwise you can't do the two-stage thing in any sane way. > Requiring "--incremental"/"--also" is very confusing. I myself did not like it but... > If somebody doesn't know about the index, he normally will never have > index changes _anyway_, except for the "git add" case. In which case "git > commit" does the right thing for him: it will either commit the added > files, or it will say "nothing to commit". ... the original complaint was that "git commit" without explicit paths does not quack like "cvs/svn commit" -- commit all my changes in the working tree. And actually the one you are responding to was my cunning move to pull this exact reaction from you: "No commit without parameter should not imply -a". I prefer the "minor twist" version in the same messge myself. To recap: - "git commit fileA..." means: update index at listed paths (add/remove if necessary) and then commit the tree described in index (the same as the current behaviour with explicit paths). - "git commit -a" means: update index with all local changes and then commit the tree described in index (the same as the current behaviour). - "git commit" means: write out the current index and commit (the same as the current behaviour). - "git commit --only fileA..." means: create a temporary index from the current HEAD commit (or empty index if there is none), update it at listed paths (add/remove if necessary) and commit the resulting tree. Also update the real index at the listed paths (add/remove if necessary). In the original index file, the paths listed must be either empty or match exactly the HEAD commit -- otherwise we error out (Linus' suggestion). - In all cases, revert the index to the state before the command is run if we end up not making the commit (e.g. index unmerged, empty log message, pre-commit hook refusal). With this, "git diff-files fileA" would show the differences as it showed beforean aborted "git commit -a" or "git commit fileA" and removes one common gripe.