Subject: Re: Call Me Gitless

From: Teemu Likonen <[email-masked]>
Date: Tue, 19 Aug 2008 11:56:22 +0300

"Peter Valdemar Mørch (Lists)" wrote (2008-08-19 09:53 +0200):

> Also, in the same area, I've now understood that to undo a "git add" - 
> to remove a change from the index and making it show up as a difference 
> between the working tree and the index - one can use "git reset" 
> (without --hard). Would've been helpful to me to have a sentense or 
> paragraph about that in git-add.txt, or even in git-reset.txt. (I guess 
> it is there in some form  in git-reset.txt, but not clearly. The "Undo 
> add" example talks about a dirty index and pull) I missed the simple 
> relationship between git-add and git-reset for a long time.

I quite agree here. I've used git about six months now and I'm quite 
familiar with the porcelain layer. I don't even care about the plumbing 
(even though I've used some plumbing commands in a script).

Anyway, to me the index wasn't difficult. It took about two days to be 
_comfortable_ enough with the idea of staging area for commits but it 
wasn't too hard. I have been a lot more confused with the

    git reset <commit> -- <file>
    git checkout <commit> -- <file>

business. These commands still aren't completely clear to me but it has 
been helpful that "git status" prints info about how to get back changes 
from the index. I think the info is a good idea because "git status" is,  
to me at least, a general "give me some clue" command.

I think the confusion with reset and checkout comes from the fact that 
first I learned that "git checkout" changes branches and later that it 
can actually check-out any commits. Checking out a file to overwrite one 
in the working directory is something I'd expect from "git reset". 
I don't think that documentation would have helped much; it's more about 
the double meaning of the commands.