我只是再次阅读 git-blame
手册页,注意到这部分:
A particularly useful way is to see if an added file has lines created by copy-and-paste from existing files. Sometimes this indicates that the developer was being sloppy and did not refactor the code properly. You can first find the commit that introduced the file with:
git log –diff-filter=A –pretty=short — foo
and then annotate the change between the commit and its parents, using commit^! notation:
git blame -C -C -f $commit^! — foo
这听起来很有趣,但是我不太了解它是如何工作的,为什么.我想知道它是否可以用于git钩子来检测复制&粘贴代码.
一些git专家可能会解释使用上述git命令在一起的效果,以及是否可以使用这样的东西来使git显示是否有代码重复(可能通过使用git似乎在重命名文件时计算的“相似性索引” )?