How to do a git diff on moved/renamed file?
问题 I moved a file using git mv . Now I would like to do a diff on the new file to compare it with the old file (with the old, now non-existent name). How do I do this? 回答1: You need to use -M to let git autodetect the moved file when diffing. Using just git diff as knittl mentioned does not work for me. So simply: git diff -M should do it. The documentation for this switch is: -M[<n>], --find-renames[=<n>] Detect renames. If n is specified, it is a threshold on the similarity index (i.e. amount