{"thread":{"id":"39823","subject":"Merge after rename","startedAt":"2015-07-09T20:44:35Z","lastAt":"2015-07-10T03:52:56Z","messageCount":2,"participants":["Phil Susi","Jacob Keller"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"265943","messageId":"559EDD33.50906@ubuntu.com","threadId":"39823","inReplyTo":null,"subject":"Merge after rename","fromName":"Phil Susi","fromEmail":"psusi@ubuntu.com","sentAt":"2015-07-09T20:44:35Z","receivedAt":"2015-07-09T20:44:35Z","isPatch":false,"sender":{"key":"psusi@ubuntu.com","avatar":null},"body":"I'm trying to cherry pick an old change from an old branch onto the \ncurrent master, and since the old change, the directory structure was \naltered and the modified files were moved.  Instead of detecting the new \nlocation of the file and applying the changes to it, git is re-adding \nthe old file at the old location in its entirety.  How can I get it to \ncorrectly notice the rename and merge the changes in at the file's new \nlocation?\n"},{"id":"265966","messageId":"CA+P7+xqzYjj6K=ws7nBN5RiMvYfQhCCZJCNvPPqBsbHkizqBng@mail.gmail.com","threadId":"39823","inReplyTo":"559EDD33.50906@ubuntu.com","subject":"Re: Merge after rename","fromName":"Jacob Keller","fromEmail":"jacob.keller@gmail.com","sentAt":"2015-07-10T03:52:56Z","receivedAt":"2015-07-10T03:52:56Z","isPatch":false,"sender":{"key":"jacob.keller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"On Thu, Jul 9, 2015 at 1:44 PM, Phil Susi <psusi@ubuntu.com> wrote:\n> I'm trying to cherry pick an old change from an old branch onto the current\n> master, and since the old change, the directory structure was altered and\n> the modified files were moved.  Instead of detecting the new location of the\n> file and applying the changes to it, git is re-adding the old file at the\n> old location in its entirety.  How can I get it to correctly notice the\n> rename and merge the changes in at the file's new location?\n>\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n\nHi Phil,\n\nOne way is to format-patch the original commit, and run it through a\nprogram like filterdiff, or edit the applied locations by hand. You\nmight also be able to use the merge subtree option.\nhttps://git-scm.com/book/en/v1/Git-Tools-Subtree-Merging is where I\nwould start.\n\nFor example, I would try something like\n\ngit cherry-pick -X subtree=path/to/strip -X subtree=path/to/add <commit>\n\nYou might also have success with\n\ngit cherry-pick --strategy=subtree\n\nwhich attempts to guess. Hopefully this helps!\n\nRegards,\nJake\n"}]}