Re: Merge after rename

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

 



On Thu, Jul 9, 2015 at 1:44 PM, Phil Susi <psusi@xxxxxxxxxx> wrote:
> I'm trying to cherry pick an old change from an old branch onto the current
> master, and since the old change, the directory structure was altered and
> the modified files were moved.  Instead of detecting the new location of the
> file and applying the changes to it, git is re-adding the old file at the
> old location in its entirety.  How can I get it to correctly notice the
> rename and merge the changes in at the file's new location?
>
> --
> 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

Hi Phil,

One way is to format-patch the original commit, and run it through a
program like filterdiff, or edit the applied locations by hand. You
might also be able to use the merge subtree option.
https://git-scm.com/book/en/v1/Git-Tools-Subtree-Merging is where I
would start.

For example, I would try something like

git cherry-pick -X subtree=path/to/strip -X subtree=path/to/add <commit>

You might also have success with

git cherry-pick --strategy=subtree

which attempts to guess. Hopefully this helps!

Regards,
Jake
--
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]