mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Jeff Garzik <jeff@garzik.org>
Cc: Avi Kivity <avi@qumranet.com>,
	linux-kernel@vger.kernel.org, kvm-devel@lists.sourceforge.net
Subject: Re: [GIT PULL] kvm oops fix
Date: Thu, 19 Apr 2007 13:30:59 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LFD.0.98.0704191325000.9964@woody.linux-foundation.org> (raw)
In-Reply-To: <4627BE6B.8030006@garzik.org>



On Thu, 19 Apr 2007, Jeff Garzik wrote:
> 
> What is the easiest way to completely undo a pull, reverting the branch to the
> HEAD present before the pull?

You can either do

	git reset --hard ORIG_HEAD

(git will set ORIG_HEAD before things like pulls or resets, so you can 
always go back), or, if you have reflogs enabled (and if you set up your 
repository with a modern git version it probably will be enabled by 
default), you can just do

	git reset --hard @{1}

where "@{1}" just means "HEAD ref state one change ago" (the same way you 
can say "@{2.hours.ago}" to mean HEAD state two hours ago).

In either case, double-check that that is indeed the version you want to 
revert to with

	git log ORIG_HEAD
 or
	git log @{1}

first, since obviously if you give "git reset --hard" the wrong version, 
it will reset to the wrong state. Although especially with reflogs, your 
previous state will always be logged, so you can always re-do what you 
undid by (again) doing "git reset --hard @{1}" to get back the previous 
state ;)

ALSO! Make sure that you don't have any dirty state in your working tree 
that you don't want to lose! "git reset --hard" will do what it implies: 
it will reset your tree. Very much including throwing away all your dirty 
state (and that you can't get back by going to a previous commit, since 
it was never committed!)

			Linus

  parent reply	other threads:[~2007-04-19 20:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-19 15:50 Avi Kivity
2007-04-19 16:53 ` Linus Torvalds
2007-04-19 19:09   ` Jeff Garzik
2007-04-19 19:24     ` [kvm-devel] " David Brown
2007-04-19 19:34       ` Jeff Garzik
2007-04-19 19:40         ` J. Bruce Fields
2007-04-19 20:30     ` Linus Torvalds [this message]
2007-04-19 22:59       ` Linus Torvalds
2007-04-20  4:54 ` [kvm-devel] " David Brown
2007-04-22  5:52   ` Avi Kivity

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=alpine.LFD.0.98.0704191325000.9964@woody.linux-foundation.org \
    --to=torvalds@linux-foundation.org \
    --cc=avi@qumranet.com \
    --cc=jeff@garzik.org \
    --cc=kvm-devel@lists.sourceforge.net \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®