How to get modified lines for renamed file in a commit with git


I cannot find a git command where I would get the diff for a renamed file in a commit correctly. So lets say we have a look at the repo pypa/pipenv and the commit d0423ac8a0bdf3454f165eb9871f7b9327f390cb. If we run the following command on our cloned repo:
git diff --stat d0423ac8a0bdf3454f165eb9871f7b9327f390cb~1 d0423ac8a0bdf3454f165eb9871f7b9327f390cb one could see that the file got renamed to

Unfortunately when I would run git show d0423ac8a0bdf3454f165eb9871f7b9327f390cb -- pipenv/vendor/shellingham/posix/ the renamed file is treated like a new file and one does not see the true changes.


Try naming the two files :

git show d0423ac8 -- pipenv/vendor/shellingham/posix/ pipenv/vendor/shellingham/posix/

Answered By – LeGEC

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published