Consider that a file (1.c) contains three functions and changes made by authors M and J. If someone runs git blame 1.c
, he will get the following output:
In this particular case, I don't think git diff
is concerned about detecting code movement; rather, it's simply creating a patch that can be applied to transform the old file into the new file, which is what your git diff
output plainly shows - the function is being deleted from one location and inserted in another. There are probably more succinct ways to output a series of edit commands that move code from one location to another, but I think git
might be erring on the side of portability here - there's no guarantee the end user wound always use git apply
or git am
, so the patch is produced in a format that can be used even with plain patch
.