From: "Björn Steinbrink" <B.Steinbrink@gmx.de>
To: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
Cc: git@vger.kernel.org
Subject: Re: understanding index
Date: Sat, 31 Jan 2009 22:18:00 +0100 [thread overview]
Message-ID: <20090131211800.GA30645@atjola.homenet> (raw)
In-Reply-To: <20090131201920.GC29748@ultras>
On 2009.01.31 21:19:20 +0100, Nicolas Sebrecht wrote:
>
> On Sat, Jan 31, 2009 at 01:09:49PM +0100, Santi Béjar wrote:
>
> > You omitted the help message of git status, where it says how to unstage:
> > # Changes to be committed:
> > # (use "git reset HEAD <file>..." to unstage)
> >
> > So to not commit foo at all:
> >
> > git reset HEAD foo
>
> Thanks. I didn't omitted the help message of git status. The "unstage"
> action is what I was looking for but I was wrongly presuming (and I've
> read git docs !) that 'HEAD' is a kind of shortcut to the last commit of
> the current branch (not to the last state of the working tree).
>
> Working on branch master for example, we have in .git/HEAD :
> ref: refs/heads/master
> And in .git/refs/heads/master, the hash of the last commit of branch
> master.
>
> I'm missing something here. But what ?
You're missing the fact that you want to reset the index entry to the
state from HEAD. The working tree state is the modified one, and you get
that into the index using "git add". But you want the index entry to be
back at the state from HEAD. So HEAD is what you need to pass to reset
(well, actually, you can skip "HEAD" there, it's the default).
Björn
prev parent reply other threads:[~2009-01-31 21:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-31 11:10 understanding index Nicolas Sebrecht
2009-01-31 12:09 ` Santi Béjar
2009-01-31 14:45 ` Alex Riesen
[not found] ` <20090131124022.GB29748@ultras>
2009-01-31 20:19 ` Nicolas Sebrecht
2009-01-31 20:57 ` Santi Béjar
[not found] ` <20090131210939.GD29748@ultras>
2009-01-31 22:07 ` Nicolas Sebrecht
2009-01-31 21:18 ` Björn Steinbrink [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090131211800.GA30645@atjola.homenet \
--to=b.steinbrink@gmx.de \
--cc=git@vger.kernel.org \
--cc=nicolas.s-dev@laposte.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).