From: Jonathan Nieder <jrnieder@gmail.com>
To: Will Palmer <wmpalmer@gmail.com>
Cc: John Tapsell <johnflux@gmail.com>, Git List <git@vger.kernel.org>,
Stephan Beyer <s-beyer@gmx.net>,
Christian Couder <chriscool@tuxfamily.org>
Subject: Re: Dangers of reset --hard (Re: Implicit stashes)
Date: Wed, 30 Jun 2010 11:12:17 -0500 [thread overview]
Message-ID: <20100630161217.GE18813@burratino> (raw)
In-Reply-To: <1277885972.2498.25.camel@wpalmer.simply-domain>
Will Palmer wrote:
> I tend to want "do a git reset --hard, but fail if anything would be
> lost".
At the risk of being redundant: try git reset --keep. If it succeeds,
you can use git diff --cached HEAD and git diff to check how close it
was to being equivalent to a hard reset.
> The use-case here is that when I reset --hard, I want a
> completely clean copy- but I don't want to accidentally lose anything.
There is one case when I truly want a completely clean copy (including
no untracked files): when I am testing and a bit paranoid. For that,
I do something like the following:
; mkdir /tmp/test-dir
; git archive HEAD | (cd /tmp/test-dir && tar -xf -)
; cd /tmp/test-dir
and work from there. I would not be surprised if the needs of your
case are different, though.
prev parent reply other threads:[~2010-06-30 16:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-30 2:48 Implicit stashes John Tapsell
2010-06-30 2:56 ` Joshua Jensen
2010-06-30 3:05 ` John Tapsell
2010-06-30 5:57 ` Sverre Rabbelier
2010-06-30 11:27 ` Alex
2010-06-30 5:13 ` Dangers of reset --hard (Re: Implicit stashes) Jonathan Nieder
2010-06-30 8:19 ` Will Palmer
2010-06-30 16:12 ` Jonathan Nieder [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=20100630161217.GE18813@burratino \
--to=jrnieder@gmail.com \
--cc=chriscool@tuxfamily.org \
--cc=git@vger.kernel.org \
--cc=johnflux@gmail.com \
--cc=s-beyer@gmx.net \
--cc=wmpalmer@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.