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

Time:11-04

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 linux.py got renamed to _proc.py

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

CodePudding user response:

Try naming the two files :

git show d0423ac8 -- pipenv/vendor/shellingham/posix/linux.py pipenv/vendor/shellingham/posix/_proc.py
  • Related