Help! Git disaster!

Johan Tibell johan.tibell at gmail.com
Thu Apr 14 17:46:33 CEST 2011


Hi,

On Thu, Apr 14, 2011 at 5:33 PM, Simon Peyton-Jones
<simonpj at microsoft.com> wrote:
> Oh *bother*.  I have no clue how this happened but I appear to have merged ghc-generics into the HEAD.  I certainly did not intend to do so.  ghc-generics is supposed to be a separate branch, and to stay that way till it works.
>
> Oh... looking back I did try to update my ghc-generics branch by saying
>        git pull origin ghc-generics
> but it appears that it updated my master branch with the remote ghc-generics branch.  Sigh.
>
> Regardless of how I managed to do this, it's still going to screw everyone else up.  Having merged it into HEAD I have no idea how to un-merge it again.  Any attempt to do so will probably just make matters worse.   Help!   Can someone (Simon? Ian? Max?  but probably only one of you) undo my mischief?
>
>        I apologise humbly.
>
> I did ask myself the question "what will 'push' do", but I was unable to find out.
>        git push --dry-run
> was uninformative.

DON'T PANIC (written with big bold friendly letters)

See http://www.kernel.org/pub/software/scm/git/docs/howto/revert-a-faulty-merge.txt

If you give me a few minutes I'll try to figure out an exact command
sequence you can run.

Aside
=====

If you hadn't pushed the change yet you could use git's reflog to go
back to any point before you got your repo into a mess. The reflog is
the linear history of changes you have applied to your local
repository (~the history effecting commands you have run). Here's how
you use it:

$ git reflog
971621b HEAD@{0}: pull --rebase: Add array copy/clone primops
25297a1 HEAD@{1}: checkout: moving from master to
25297a13bd6be722a74ee87237498a5626b298ef^0
09437c3 HEAD@{2}: pull --rebase: Add array copy/clone primops
592b33e HEAD@{3}: checkout: moving from master to
592b33e265756d6b9ce156d53f187090366ae29b^0

If I wanted to go back in time to before I ran pull --rebase the last
time I would do:

$ git reset --hard HEAD@{1}, which would discard the very last change
I did to the repo.

The reflog makes it hard to actually damage your local repository, no
matter what you do. The reflog works because commits are never really
lost (except for when you run git gc), they are merely not referred to
by any named reference (e.g. HEAD, master, my-branch, etc) anymore.
The reflog still keeps track of the commits SHA-1 and thus git can
find the commit again.

>
>
> Simon
>
> -----Original Message-----
> From: cvs-ghc-bounces at haskell.org [mailto:cvs-ghc-bounces at haskell.org] On Behalf Of Simon Peyton Jones
> Sent: 14 April 2011 16:22
> To: cvs-ghc at haskell.org
> Subject: [commit: ghc] master: Merge branch 'ghc-generics' of http://darcs.haskell.org/ghc (5305c38)
>
> Repository : ssh://darcs.haskell.org//srv/darcs/ghc
>
> On branch  : master
>
> http://hackage.haskell.org/trac/ghc/changeset/5305c38484cccf341e761e05614d414cd77dfec9
>
>>---------------------------------------------------------------
>
> commit 5305c38484cccf341e761e05614d414cd77dfec9
> Merge: 2c618c2... ce2ea82...
> Author: unknown <simonpj at .europe.corp.microsoft.com>
> Date:   Thu Apr 14 16:15:10 2011 +0100
>
>    Merge branch 'ghc-generics' of http://darcs.haskell.org/ghc
>
>  compiler/basicTypes/OccName.lhs     |   26 ++-
>  compiler/deSugar/DsMeta.hs          |    1 +
>  compiler/hsSyn/HsBinds.lhs          |   28 ++-
>  compiler/hsSyn/HsUtils.lhs          |    2 +-
>  compiler/iface/BuildTyCl.lhs        |    8 +-
>  compiler/iface/MkIface.lhs          |    6 +-
>  compiler/main/HscStats.lhs          |   22 +-
>  compiler/parser/Lexer.x             |    4 +-
>  compiler/parser/Parser.y.pp         |   11 +-
>  compiler/parser/RdrHsSyn.lhs        |   13 +-
>  compiler/prelude/PrelNames.lhs      |  161 +++++++++++-
>  compiler/rename/RnBinds.lhs         |   24 ++-
>  compiler/rename/RnHsSyn.lhs         |    9 +-
>  compiler/rename/RnSource.lhs        |   11 -
>  compiler/typecheck/TcClassDcl.lhs   |  222 +++++++---------
>  compiler/typecheck/TcDeriv.lhs      |  165 +++++++++++-
>  compiler/typecheck/TcEnv.lhs        |    6 +-
>  compiler/typecheck/TcGenDeriv.lhs   |    2 +-
>  compiler/typecheck/TcInstDcls.lhs   |   21 ++-
>  compiler/typecheck/TcRnDriver.lhs   |    9 +-
>  compiler/typecheck/TcTyClsDecls.lhs |   23 ++-
>  compiler/types/Class.lhs            |   10 +-
>  compiler/types/Generics.lhs         |  502 ++++++++++++++++++++++++++---------
>  compiler/types/TyCon.lhs            |    7 +-
>  compiler/types/Type.lhs             |    6 +-
>  25 files changed, 941 insertions(+), 358 deletions(-)
>
>
>
>
> |  -----Original Message-----
> |  From: cvs-ghc-bounces at haskell.org [mailto:cvs-ghc-bounces at haskell.org] On Behalf
> |  Of Simon Peyton Jones
> |  Sent: 14 April 2011 16:22
> |  To: cvs-ghc at haskell.org
> |  Subject: [commit: ghc] master's head updated: Merge branch 'ghc-generics' of
> |  http://darcs.haskell.org/ghc (5305c38)
> |
> |  Repository : ssh://darcs.haskell.org//srv/darcs/ghc
> |
> |  Branch 'master' now includes:
> |
> |       2a26efb... Initial commit for Pedro's new generic default methods (See his Haskell
> |  Symposium 2010 paper     "A generic deriving mechaism for Haskell")
> |       83f16ad... Adapt mkGenericDefMethBind to the new generics
> |       8419203... Merge branch 'master' of c:/code/HEAD-git/. into ghc-generics
> |       2fcc09a... Minor refactoring of Max's patch for #4404
> |       27fc7ca... Merge branch 'master' of http://darcs.haskell.org/ghc
> |       ce2ea82... Small fixes to the generics branch to get rid of warnings, plus a false
> |  ASSERT failure
> |       2c618c2... Merge branch 'master' of http://darcs.haskell.org/ghc
> |       5305c38... Merge branch 'ghc-generics' of http://darcs.haskell.org/ghc
> |
> |  _______________________________________________
> |  Cvs-ghc mailing list
> |  Cvs-ghc at haskell.org
> |  http://www.haskell.org/mailman/listinfo/cvs-ghc
>
>
> _______________________________________________
> Cvs-ghc mailing list
> Cvs-ghc at haskell.org
> http://www.haskell.org/mailman/listinfo/cvs-ghc
>



More information about the Cvs-ghc mailing list