{"thread":{"id":"21908","subject":"Undoing merges","startedAt":"2009-12-08T16:37:37Z","lastAt":"2009-12-14T11:45:09Z","messageCount":3,"participants":["Richard","Matthieu Moy"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"129564","messageId":"8440EA2C12E50645A68C4AA98871665131D8D8@SERVER.webdezign.local","threadId":"21908","inReplyTo":null,"subject":"Undoing merges","fromName":"Richard","fromEmail":"richard@webdezign.co.uk","sentAt":null,"receivedAt":"2009-12-08T16:37:37Z","isPatch":false,"sender":{"key":"richard@webdezign.co.uk","avatar":"https://gravatar.com/avatar/36c0bc285b2d30baa54ed2e1488161fd27a4a4a8128836a673b66204ab08c9b7?d=mp&s=160"},"body":"Hi git list,\n\nI'm trying to find out how to undo a merge. I know that my branches are\nindependent and that I can just carry on working on them and merge again\nlater, but I'm just trying to keep my revision graph tidier. Should I\neven be undoing merges?\n\nI've searched around, but I can seem to find an answer I can follow.\n\nRegards,\n\nRichard\n"},{"id":"129565","messageId":"vpqpr6pqrvq.fsf@bauges.imag.fr","threadId":"21908","inReplyTo":"8440EA2C12E50645A68C4AA98871665131D8D8@SERVER.webdezign.local","subject":"Re: Undoing merges","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2009-12-08T17:48:09Z","receivedAt":"2009-12-08T17:48:09Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"\"Richard\" <richard@webdezign.co.uk> writes:\n\n> Hi git list,\n>\n> I'm trying to find out how to undo a merge.\n\nWhen sitting on a merge commit,\n\n  git reset --merge HEAD^\n\nwill undo this merge commit (i.e. pretend the merge has never occured,\nat least in your branch). Don't do that if you already published this\nmerge commit.\n\n> I know that my branches are independent and that I can just carry on\n> working on them and merge again later, but I'm just trying to keep\n> my revision graph tidier. Should I even be undoing merges?\n\nIf it's about cleaning up your history, \"git rebase\" is your friend,\ntoo (with the same limitation: don't do that on published history). By\ndefault, it does some kind of history flattening.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"129865","messageId":"8440EA2C12E50645A68C4AA98871665131D9AC@SERVER.webdezign.local","threadId":"21908","inReplyTo":"vpqpr6pqrvq.fsf@bauges.imag.fr","subject":"RE: Undoing merges","fromName":"Richard","fromEmail":"richard@webdezign.co.uk","sentAt":null,"receivedAt":"2009-12-14T11:45:09Z","isPatch":false,"sender":{"key":"richard@webdezign.co.uk","avatar":"https://gravatar.com/avatar/36c0bc285b2d30baa54ed2e1488161fd27a4a4a8128836a673b66204ab08c9b7?d=mp&s=160"},"body":"Hi again Matt,\n\nThanks for the reply.\n\n> > Hi git list,\n> >\n> > I'm trying to find out how to undo a merge.\n> \n> When sitting on a merge commit,\n> \n>   git reset --merge HEAD^\n> \n> will undo this merge commit (i.e. pretend the merge has never\n> occurred, at least in your branch). Don't do that if you already\n> published this merge commit.\n\nThe problem that I'm far past the merge commit.\n\n> > I know that my branches are independent and that I can just carry on\n> > working on them and merge again later, but I'm just trying to keep\n> > my revision graph tidier. Should I even be undoing merges?\n> \n> If it's about cleaning up your history, \"git rebase\" is your friend,\n> too (with the same limitation: don't do that on published history). By\n> default, it does some kind of history flattening.\n\nI had a look at the git-rebase man page and it showed to remove a commit\nfrom the middle of a range of commits. I think as I am on longer on the\nmerge commit and cannot use \"git reset --merge HEAD^\", I can rebase all\nthe commits from the commit just after the merge onto the commit just\nbefore the merge and that will remove the merge. Unfortunately I didn't\nget a change to try that out so I don't know whether it will work or\nnot.\n\nRichard\n"}]}