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

前端 未结 13 2050
青春惊慌失措
青春惊慌失措 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:18

    For comparing to 5 commit to the current one, both on master, just simply do:

    git diff master~5:pom.xml master:pom.xml
    

    Also you can refer to commit hash number, for example if the hash number is x110bd64, you can do something like this to see the difference:

    git diff x110bd64 pom.xml
    

提交回复
热议问题