{"thread":{"id":"46324","subject":"Dropping a merge from history -- rebase or filter-branch or ...?","startedAt":"2017-07-07T21:07:44Z","lastAt":"2017-07-12T02:06:58Z","messageCount":2,"participants":["Martin Langhoff","Andrew Ardill"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"323977","messageId":"CACPiFC+Lc+ewmPe6u=dUo4rJRcgLqRfG-EG+vudg8mapnH-d9w@mail.gmail.com","threadId":"46324","inReplyTo":null,"subject":"Dropping a merge from history -- rebase or filter-branch or ...?","fromName":"Martin Langhoff","fromEmail":"martin.langhoff@gmail.com","sentAt":"2017-07-07T21:07:18Z","receivedAt":"2017-07-07T21:07:44Z","isPatch":false,"sender":{"key":"martin.langhoff@gmail.com","avatar":"https://gravatar.com/avatar/1e3f311b6c4c15836501901ca58f8c0b0667246488084ba524d8bc9867e22fd9?d=mp&s=160"},"body":"Hi git-folk!\n\nlong time no see! I'm trying to do one of those \"actually, please\ndon't\" things that turn out to be needed in the field.\n\nI need to open our next \"for release\" development branch from our\nmaster, but without a couple of disruptive feature branches, which\nhave been merged into master already. We develop in github, so I'll\ncall them Pull Requests (PRs) as gh does.\n\nSo I'd like to run a filter-branch or git-rebase --interactive\n--preserve-merges that drops some PRs. Problem is, they don't work!\n\nfilter-branch --commit-filter is fantastic, and gives me all the\ncontrol I want... except that it will \"skip the commit\", but still use\nthe trees in the later commits, so the code changes brought in by\nthose commits I wanted to avoid will be there. I think the docs/help\nthat discuss  \"skip commit\" should have a big warning there!\n\nrebase --interactive --preserve-merges  --keep-empty made a complete\nhash of things. Nonsense conflicts all over on the merge commits; I\nthink it re-ran the merge without picking up the conflict resolutions\nwe had applied.\n\nThe changes we want to avoid are fairly localized -- a specific module\ngot refactored in 3 stages. The rest of the history should replay\ncleanly. I don't want to delete the module.\n\nMy fallback is a manually constructed revert. While still an option, I\nthink it's better to have a clean stat without sizable feature-branch\nreverts.\n\ncheers,\n\n\n\nm\n-- \n martin.langhoff@gmail.com\n - ask interesting questions  ~  http://linkedin.com/in/martinlanghoff\n - don't be distracted        ~  http://github.com/martin-langhoff\n   by shiny stuff\n"},{"id":"324253","messageId":"CAH5451mGTkVVoNJS44Y1AMwvHVeuYNZv5Tp89LDp0skx8ZNeYQ@mail.gmail.com","threadId":"46324","inReplyTo":"CACPiFC+Lc+ewmPe6u=dUo4rJRcgLqRfG-EG+vudg8mapnH-d9w@mail.gmail.com","subject":"Re: Dropping a merge from history -- rebase or filter-branch or ...?","fromName":"Andrew Ardill","fromEmail":"andrew.ardill@gmail.com","sentAt":"2017-07-12T02:06:12Z","receivedAt":"2017-07-12T02:06:58Z","isPatch":false,"sender":{"key":"andrew.ardill@gmail.com","avatar":"https://gravatar.com/avatar/da14cb7c091dd44dc6c63a4d3361b149acaf25226dc78eb4131a17b93d9b0993?d=mp&s=160"},"body":"Hi Martin,\n\nFrom the sound of it you really just want to revert the merge of the\npull requests. A really good description of options for this is at\nhttps://git-scm.com/blog/2010/03/02/undoing-merges.html\n\nThere is also a section there about bringing the changes back in at a\nfuture date, depending on how you do the revert.\n\nDoes that page describe what you're trying to do?\n\nRegards,\n\nAndrew Ardill\n\n\nOn 8 July 2017 at 07:07, Martin Langhoff <martin.langhoff@gmail.com> wrote:\n> Hi git-folk!\n>\n> long time no see! I'm trying to do one of those \"actually, please\n> don't\" things that turn out to be needed in the field.\n>\n> I need to open our next \"for release\" development branch from our\n> master, but without a couple of disruptive feature branches, which\n> have been merged into master already. We develop in github, so I'll\n> call them Pull Requests (PRs) as gh does.\n>\n> So I'd like to run a filter-branch or git-rebase --interactive\n> --preserve-merges that drops some PRs. Problem is, they don't work!\n>\n> filter-branch --commit-filter is fantastic, and gives me all the\n> control I want... except that it will \"skip the commit\", but still use\n> the trees in the later commits, so the code changes brought in by\n> those commits I wanted to avoid will be there. I think the docs/help\n> that discuss  \"skip commit\" should have a big warning there!\n>\n> rebase --interactive --preserve-merges  --keep-empty made a complete\n> hash of things. Nonsense conflicts all over on the merge commits; I\n> think it re-ran the merge without picking up the conflict resolutions\n> we had applied.\n>\n> The changes we want to avoid are fairly localized -- a specific module\n> got refactored in 3 stages. The rest of the history should replay\n> cleanly. I don't want to delete the module.\n>\n> My fallback is a manually constructed revert. While still an option, I\n> think it's better to have a clean stat without sizable feature-branch\n> reverts.\n>\n> cheers,\n>\n>\n>\n> m\n> --\n>  martin.langhoff@gmail.com\n>  - ask interesting questions  ~  http://linkedin.com/in/martinlanghoff\n>  - don't be distracted        ~  http://github.com/martin-langhoff\n>    by shiny stuff\n"}]}