git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Jeff King <peff@peff.net>
Cc: Bill Lear <rael@zopyra.com>, git@vger.kernel.org
Subject: Re: 'git checkout -f' versus 'git reset --hard'
Date: Thu, 5 Apr 2007 11:29:25 -0400	[thread overview]
Message-ID: <20070405152925.GG5436@spearce.org> (raw)
In-Reply-To: <20070405134311.GA18163@coredump.intra.peff.net>

Jeff King <peff@peff.net> wrote:
> On Thu, Apr 05, 2007 at 08:36:09AM -0500, Bill Lear wrote:
> 
> > After a failed merge, I want to undo things.  I typically use git
> > reset --hard, and it works like a charm.  Others have tried to use git
> > checkout -f, but I have cautioned that git reset --hard is really the
> > way to do it.  Is there a difference here, or are they equivalent?
> 
> Skimming through the code (and looking at the output of sh -x), it looks
> like both just end up executing git-read-tree --reset -u $HEAD.

Sure, but git-reset also whacks MERGE_MSG, rr-cache/MERGE_RR,
SQUASH_MSG, SQUASH_HEAD.  Maybe checkout should do the same.

I guess checkout -f is fine, and does the job, but usually we say
reset --hard.  :-)

-- 
Shawn.

  reply	other threads:[~2007-04-05 15:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-05 13:36 'git checkout -f' versus 'git reset --hard' Bill Lear
2007-04-05 13:43 ` Jeff King
2007-04-05 15:29   ` Shawn O. Pearce [this message]
2007-04-05 15:43 ` Linus Torvalds

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=20070405152925.GG5436@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=rael@zopyra.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 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).