From: Johannes Sixt <j.sixt@viscovery.net>
To: Thomas Guyot-Sionnest <dermoth@aei.ca>
Cc: git@vger.kernel.org
Subject: Re: git reset --hard and uncommitted files in index
Date: Fri, 22 May 2009 08:43:53 +0200 [thread overview]
Message-ID: <4A1649A9.5090606@viscovery.net> (raw)
In-Reply-To: <gv52s4$e7h$1@ger.gmane.org>
Thomas Guyot-Sionnest schrieb:
> Today I was working on a script that modify many files on a repository,
> therefore during testing phase I needed to reset --hard to get back to
> the last commit. This operation does not affect untracked files.
>
> Since i was going to commit the script, at some point I decided to add
> it to the index so I could track/revert changes to it. On the next reset
> Git deleted the script.
>
> Fortunately "git add" creates an object that I could easily recover
> (thanks to wereHamster on #git for pointing that out), however I was
> wondering if it's really the desired behavior to *delete* a file that
> have been added to the index but isn't on the previous commit? Shouldn't
> git just unstage it?
No, the behavior is by design. Its purpose is to return the working
directory to a clean slate. For example, after a conflicted merge the
merged branch may have brought new files, but you wouldn't want to keep
them around after the cleanup.
'git reset --hard' is "do what I say", not "do what I mean". ;-)
-- Hannes
next prev parent reply other threads:[~2009-05-22 6:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-22 2:32 git reset --hard and uncommitted files in index Thomas Guyot-Sionnest
2009-05-22 6:43 ` Johannes Sixt [this message]
2009-05-22 10:50 ` Sverre Rabbelier
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=4A1649A9.5090606@viscovery.net \
--to=j.sixt@viscovery.net \
--cc=dermoth@aei.ca \
--cc=git@vger.kernel.org \
/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).