public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail•com>
To: Brent Goodrick <bgoodr@gmail•com>
Cc: git@vger•kernel.org
Subject: Re: How do I undo a fast-forward merge safely?
Date: Sun, 22 Feb 2009 11:54:47 -0800 (PST)	[thread overview]
Message-ID: <m3fxi6s0vu.fsf@localhost.localdomain> (raw)
In-Reply-To: <e38bce640902221115o2dd1c63dv6f7acc374b48d418@mail.gmail.com>

Brent Goodrick <bgoodr@gmail•com> writes:

> I had done a git merge --no-commit <source_branch> operation, but that
> bit me because I mistakingly concluded that --no-commit would prevent
> any type of automatic operation, but apparently a fast-forward
> occurred.  I should have used the --no-ff option? How do I get my
> target branch back to where it was before the bad merge?

[...]
> So, what operations, rebase, reset, etc, do I need to do to get this
> repo back to where it was right before the fast-forward?

Each 'large' operation sets ORIG_HEAD

  $ git reset --hard ORIG_HEAD

If you want to be more careful, examine reflog for HEAD, using either
"git reflog" or "git log -g", and you can reset to previous version of
HEAD (i.e. where current branch pointed to before 'git fetch') with

  $ git reset --hard HEAD@{1}

-- 
Jakub Narebski
Poland
ShadeHawk on #git

  reply	other threads:[~2009-02-22 19:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-22 19:15 How do I undo a fast-forward merge safely? Brent Goodrick
2009-02-22 19:54 ` Jakub Narebski [this message]
2009-02-24  5:37   ` Brent Goodrick

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=m3fxi6s0vu.fsf@localhost.localdomain \
    --to=jnareb@gmail$(echo .)com \
    --cc=bgoodr@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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