0

This may not be what git is designed for - which I can accept - but I'm curious if this is possible, seeing as it comes up alot for me.

Scenario: A developer moves method X from file A to file B (both existing tracked files). I want to know if they also changed method X on copy

Now, if I use gitk to inspect file B, I can see the introduction of the method. The issue is that I want to know if the method was simply copy/pasted, or also modified in the process.

My gut says that this information is lost, but is there a way I can reverse engineer which file method X was copied from using git?

I.e. Solve for file A using git. Is this possible?

Matt
  • 1,674
  • 2
  • 16
  • 34
  • 1
    Possible duplicate of [Can Git really track the movement of a single function from 1 file to another? If so, how?](http://stackoverflow.com/questions/4908336/can-git-really-track-the-movement-of-a-single-function-from-1-file-to-another-i) – ketan vijayvargiya Oct 18 '16 at 16:37
  • Thanks, looks like `git blame -C` is the answer. I'll answer this for a quick answer, and link back to that for verbosity. – Matt Oct 18 '16 at 17:43

1 Answers1

0

git blame -C is the command to use.

Here is the man page, and a near duplicate question (how does it work? vs what do I use?) with a more verbose answer.

Community
  • 1
  • 1
Matt
  • 1,674
  • 2
  • 16
  • 34