You can do it as follows:
git diff <file_path_relative_to_project_root>
Edited by:
Explanation : It took a while to figure this out. Whenever git log -p <file> , it shows the commits where the file has ever been affected, and the differences for the same file. This means that if you want to follow the full history of the file, you can add the - follow option and see the full history.
But when you enter this command: git log --full-diff -p file , it shows you all the commits where this file has ever been affected, plus now it not only shows diff for the specified file, but also shows diff for everyone files that were affected by commit. This means that it gives you the result for multiple files.
If you try this command: git log help you will see that the - follow option can only be used for one file, so you can have this command: git log --follow -p file , since it shows the results for only one file.
But it cannot be used with the following command: git log --full-diff --follow -p file , since it shows results for multiple files, and this query will result in an error.
sahil source share