Re: How do I undo a fast-forward merge safely?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Brent Goodrick <bgoodr@xxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux