Git: How to diff two different files in different commits?

核能气质少年 提交于 2019-12-10 02:13:58

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!