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

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Carl Worth <cworth@...>
Cc: Nicolas Pitre <nico@...>, Linus Torvalds <torvalds@...>, Theodore Tso <tytso@...>, Andreas Ericsson <ae@...>, Johannes Schindelin <Johannes.Schindelin@...>, Junio C Hamano <junkio@...>, <git@...>
Date: Thursday, November 30, 2006 - 5:33 pm

Carl Worth wrote:

Exactly. We had a tutorial for the project I contribute to (admittedly 
the initial users were all used to how CVS worked) and while a number of 
people got the concept of the index and were fairly happy with it, it 
did add to the confusion of the tutorial, so now it doesn't mention the 
index at all.

The tutorial introduced it as a staging area for commits, but the 
trouble is that once you work like this you have to remember that 
"git-diff" won't show you what will be committed, so you have to use 
"git-diff-index" as well. If you get them mixed up then you end up 
committing the wrong thing.

Here's a selected list of the commands introduced in the tutorial, 
without mentioning the index:
git diff
git commit -a
git commit <changed-files>
git reset HEAD^
git cherry-pick

Here would be the same entries, but introducing the index too:
git-update-index
git diff
git diff-index
git commit
git commit -a
git commit <changed-files>
git reset HEAD^
git reset --soft HEAD^
git cherry-pick
git cherry-pick -n

The tutorial then goes from having ~12 common commands to learn up to ~17.


Having the index exposed for even simple operations means that the user 
has to initially learn three states instead of two. The worst thing 
about the index is that it is a limbo state. The committed content is in 
the history and can be viewed by gitk (and other tools that the user 
will be introduced to later) and the working tree is exactly what the 
user sees in their editor. Having a hidden state isn't very good from an 
HCI point of view.

Once you understand the concept of the index, it is very useful. 
However, new users should be shielded from it if at all possible.

I'm not advocating making "git-commit" equal to "git-commit -a" as I've 
been frustrated by command's semantics changing in git before. I can 
understand long-time git users would automatically try to use 
"git-commit" to just commit their index and get annoyed if it did 
something unexpected. Therefore, I would advocate there being no default 
behaviour for "git-commit" except for displaying a help message, and 
making previous "git-commit" users now use "git-commit -i".

-- 
Rob Shearman

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH 0/2] Making "git commit" to mean "git commit -a"., Johannes Schindelin, (Wed Nov 29, 10:11 pm)
Re: [PATCH 0/2] Making "git commit" to mean "git commit -a"., Linus Torvalds, (Wed Nov 29, 11:10 pm)
Re: [PATCH 0/2] Making "git commit" to mean "git commit -a"., Andreas Ericsson, (Thu Nov 30, 7:09 am)
Re: [PATCH 0/2] Making "git commit" to mean "git commit -a"., Linus Torvalds, (Thu Nov 30, 11:58 am)
Re: [PATCH 0/2] Making "git commit" to mean "git commit -a"., Robert Shearman, (Thu Nov 30, 5:33 pm)
Re: [PATCH 0/2] Making "git commit" to mean "git commit -a"., Andreas Ericsson, (Fri Dec 1, 4:59 am)
Re: [PATCH 0/2] Making "git commit" to mean "git commit -a"., Linus Torvalds, (Thu Nov 30, 10:44 pm)
Re: [PATCH 0/2] Making "git commit" to mean "git commit -a"., Michael K. Edwards, (Thu Nov 30, 11:52 pm)
Re: [PATCH 0/2] Making "git commit" to mean "git commit -a"., Johannes Schindelin, (Thu Nov 30, 6:27 am)
Re: [PATCH 0/2] Making "git commit" to mean "git commit -a"., Junio C Hamano, (Wed Nov 29, 10:12 pm)