# Moved code detection with `git apply` a la `git blame -C -C`

2 messages from 2015-08-18 to 2015-08-19. Participants: Anish Tondwalkar, Jacob Keller.
Thread: https://gitlist.dev/t/40126

## Anish Tondwalkar, 2015-08-18 20:11

Subject: Moved code detection with `git apply` a la `git blame -C -C`
Message-ID: <CALZPV0Dgmu5fJqQEXwxVvn9Na6jUtvkDbAwY9mAZKeFSMqo8xQ@mail.gmail.com>
URL: https://gitlist.dev/e/CALZPV0Dgmu5fJqQEXwxVvn9Na6jUtvkDbAwY9mAZKeFSMqo8xQ%40mail.gmail.com

```
I stashed some changes, then refactored my code to move the function
they're in into a new file. Now, I want to apply it to the new file. I
know git can figure out this relationship between the files, because
`git blame -C -C` can find it, but is there a "more idiomatic" way to
apply this diff than to have git spit out a diff, and edit it
manually?

-- 
Anish

```

## Jacob Keller, 2015-08-19 06:42

Subject: Re: Moved code detection with `git apply` a la `git blame -C -C`
Message-ID: <CA+P7+xrbE9TxzXWwixOv12r0wb=Y17BRxyKFHGTUb0-4Q+wyhA@mail.gmail.com>
URL: https://gitlist.dev/e/CA%2BP7%2BxrbE9TxzXWwixOv12r0wb%3DY17BRxyKFHGTUb0-4Q%2BwyhA%40mail.gmail.com
In-Reply-To: <CALZPV0Dgmu5fJqQEXwxVvn9Na6jUtvkDbAwY9mAZKeFSMqo8xQ@mail.gmail.com>

```
Maybe something along the lines of a git-subtree merge. I am not sure
how to do that exactly, and I am not sure that it would be worth the
trouble to setup for a small case...

On Tue, Aug 18, 2015 at 1:11 PM, Anish Tondwalkar
<tondwalkar@virginia.edu> wrote:
> I stashed some changes, then refactored my code to move the function
> they're in into a new file. Now, I want to apply it to the new file. I
> know git can figure out this relationship between the files, because
> `git blame -C -C` can find it, but is there a "more idiomatic" way to
> apply this diff than to have git spit out a diff, and edit it
> manually?
>
> --
> Anish
> --
> 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

```
