git diff on date?

后端 未结 3 1574
你的背包
你的背包 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:49

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

    This is not, strictly speaking, the revision made three weeks ago. Instead, it's the position HEAD was at three weeks prior to the present. But it's probably close enough for your purposes - it will be very accurate if the current branch's HEAD moved forward steadily, as most tend to do. You can improve the accuracy by using a branch name instead of HEAD.

    Instead of an offset-from-the-present, you can also use a date/time, like HEAD@{1979-02-26 18:30:00}. See git help rev-parse.

提交回复
热议问题