git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Merge after rename
@ 2015-07-09 20:44 Phil Susi
  2015-07-10  3:52 ` Jacob Keller
  0 siblings, 1 reply; 2+ messages in thread
From: Phil Susi @ 2015-07-09 20:44 UTC (permalink / raw)
  To: git@vger.kernel.org

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?

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Merge after rename
  2015-07-09 20:44 Merge after rename Phil Susi
@ 2015-07-10  3:52 ` Jacob Keller
  0 siblings, 0 replies; 2+ messages in thread
From: Jacob Keller @ 2015-07-10  3:52 UTC (permalink / raw)
  To: Phil Susi; +Cc: git@vger.kernel.org

On Thu, Jul 9, 2015 at 1:44 PM, Phil Susi <psusi@ubuntu.com> 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@vger.kernel.org
> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-10  3:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-09 20:44 Merge after rename Phil Susi
2015-07-10  3:52 ` Jacob Keller

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).