git diff日期? [英] git diff on date?

查看:203
本文介绍了git diff日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  git diff HEAD HEAD 

我习惯于运行一个可以与本地git revs进行比较的git比较。 〜110 - some / file / path / file.ext

是否可以使用日期?如果是这样,怎么样?我希望能在上面的例子中插入110,例如2012年12月4日。 >

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

严格来说,这不是三周前的修订。相反,它的位置 HEAD 是在现在的三周前。但是它可能足够满足您的需求 - 如果当前分支的 HEAD 稳步前进,那将是非常准确的,正如大多数人一样。您可以通过使用分支名称而不是 HEAD 来提高准确性。



而不是从偏移量现在,您还可以使用日期/时间,如 HEAD @ {1979-02-26 18:30:00} 。见 git help rev-parse


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

Is it possible to use the date instead? And if so, how? I would like to be able insert in place of the "110" in the above example, a date such as "4 Dec 2012".

解决方案

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.

这篇关于git diff日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆