问题
I have a repository where a number of files have been renamed from .html to .php and further edited in a number of commits since my last pull. Using git diff
to shows all the html
contents removed and all the php
content added. Is there a neat way to have git diff
detect the renames (something like git log --follow
does), or directly compare different filenames across different commits (something like the solution in Git: How to diff two different files in different branches? , but for commits)?
回答1:
You can always compare 2 files in 2 different commits:
git diff commit1:file1_path commit2:file2_path
来源:https://stackoverflow.com/questions/43041882/git-how-to-diff-two-different-files-in-different-commits