git diff on date?

后端 未结 3 1566
你的背包
你的背包 2020-12-13 08:22

I\'m accustomed to running a git comparison that will allow comparison with local git revs like:

git diff HEAD HEAD~110 -- some/file/path/file.ext

3条回答
  •  自闭症患者
    2020-12-13 08:46

    What you want must be this.

    git diff HEAD '@{3 weeks ago}' -- some/file/path/file.ext
    

    You should compare with @{3 weeks ago}, not HEAD@{3 weeks ago}.

    What is difference?

    If you were on another branch 3 weeks ago, HEAD@{3 weeks ago} would point the HEAD of the branch, on the other hand @{3 weeks ago} would point the HEAD of the current branch.

    You can also explicitly name the branch.

    git diff HEAD 'master@{3 weeks ago}' -- some/file/path/file.ext
    

提交回复
热议问题