Re: [PATCH 0/2] Making "git commit" to mean "git commit -a".

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 30 Nov 2006 16:21:56 -0800 (PST), Linus Torvalds wrote:
> Exactly what the command says. "git commit" says "commit everything I've
> told you to commit". While "git commit filename" says "commit the changes
> that I've made to this file".
>
> Yes, they are two totally different cases, but nobody sane can claim that
> it is strange.

Call me insane.

I think it is very strange that the following command sequences commit
different content for myfile:

	echo old > myfile
	git add myfile
	echo new > myfile
	git commit

compared to:

	echo old > myfile
	git add myfile
	echo new > myfile
	git commit myfile

The difference there is very subtle and really does prevent a
reasonable, "just ignore the index and you can use git comfortably".

Now, the behavior above can be explained. You and I both understand it
just fine. And Nico's proposed tutorial document even explains it,
(twists and all).

But it is strange, and I cannot see how the first case is at all useful.

The point is that by-and-large I don't ever want to commit anything
that is not present in my working tree at the time I type
"commit". That's precisely why I'm typing "commit" at that time.

If I do ever want to commit content that is not currently in my
working tree, then I should have to do something
exceptional. Otherwise, git will always have user-interface traps that
will trip people up.

You might point at my first example and say that the timing of my "git
add" command is the exceptional thing I did to trigger the old commit.
But the second command above destroys that explanation. In the second,
the timing of "git add" doesn't trigger any exceptional behavior at
all. The new content of the file is still committed.

> Exactly _because_ you explicitly list the filename, that
> also means that you want the file content AT THAT TIME. If you don't list
> the filename, you obviously must be talking about committing something you
> did earlier.

You're explaining the behavior, but not providing any justification
for this being the right thing based on what a user actually wants to
do.

-Carl

Attachment: pgpRid7uSDule.pgp
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]