git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jacob Keller <jacob.keller@gmail.com>
To: Phil Susi <psusi@ubuntu.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Merge after rename
Date: Thu, 9 Jul 2015 20:52:56 -0700	[thread overview]
Message-ID: <CA+P7+xqzYjj6K=ws7nBN5RiMvYfQhCCZJCNvPPqBsbHkizqBng@mail.gmail.com> (raw)
In-Reply-To: <559EDD33.50906@ubuntu.com>

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

      reply	other threads:[~2015-07-10  3:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-09 20:44 Merge after rename Phil Susi
2015-07-10  3:52 ` Jacob Keller [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+P7+xqzYjj6K=ws7nBN5RiMvYfQhCCZJCNvPPqBsbHkizqBng@mail.gmail.com' \
    --to=jacob.keller@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=psusi@ubuntu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).