How to diff one file to an arbitrary version in Git?

前端 未结 13 2042
青春惊慌失措
青春惊慌失措 2020-12-07 07:12

How can I diff a file, say pom.xml, from the master branch to an arbitrary older version in Git?

13条回答
  •  太阳男子
    2020-12-07 07:27

    To see what was changed in a file in the last commit:

    git diff HEAD~1 path/to/file
    

    You can change the number (~1) to the n-th commit which you want to diff with.

提交回复
热议问题