git date语法规范 [英] Specification for syntax of git dates

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

问题描述

是否有关于传递日期语法的规范 混蛋?例如, "--before"选项是否为"git rev-list"?

Is there any specification for the syntax of dates passed to git? For example, what dates are accepted by the "--before" option to "git rev-list"?

假设没有这样的规范,有没有 使git将日期转换为规范的方法 形式,以便可以检查给定的日期字符串 被解释为人们所期望的? (更新:我已经 编写了一个脚本来做到这一点,这是可用的 此处.)

Assuming there is no such specification, is there any way to get git to transform a date into a canonical form, so that one can check that a given date string is being interpreted as one expects? (Update: I've written a script to do this, which is available here.)

信息说明:似乎已实现日期解析 在文件date.c中,在git存储库的根目录中. 入口点"似乎是一个称为 roxidate_careful.

Informational note: date parsing seems to be implemented in the file date.c, in the root of git's repository. The "entry point" seems to be a function called approxidate_careful.

推荐答案

据我所知,它没有在任何地方明确指出,但它似乎接受它可以输出的所有格式,如选项:

It’s not explicitly noted anywhere as far as I can tell, but it seems to accept all formats that it can output, as described in the documentation for the --date option:

--date=(relative|local|default|iso|rfc|short|raw)

仅对以人类可读格式显示的日期生效,例如使用 --pretty. log.date config变量设置日志的默认值 命令的--date选项.

--date=(relative|local|default|iso|rfc|short|raw)

Only takes effect for dates shown in human-readable format, such as when using --pretty. log.date config variable sets a default value for log command’s --date option.

--date=relative显示相对于当前时间的日期,例如"2小时前".

--date=relative shows dates relative to the current time, e.g. "2 hours ago".

--date=local显示用户本地时区中的时间戳.

--date=local shows timestamps in user’s local timezone.

--date=iso(或--date=iso8601)以ISO 8601格式显示时间戳.

--date=iso (or --date=iso8601) shows timestamps in ISO 8601 format.

--date=rfc(或--date=rfc2822)以RFC 2822格式显示时间戳,通常在电子邮件中找到.

--date=rfc (or --date=rfc2822) shows timestamps in RFC 2822 format, often found in E-mail messages.

--date=short仅以YYYY-MM-DD格式显示日期,而不显示时间.

--date=short shows only date but not time, in YYYY-MM-DD format.

--date=raw以内部原始git格式%s %z格式显示日期.

--date=raw shows the date in the internal raw git format %s %z format.

--date=default显示原始时区(提交者或作者)的时间戳.

--date=default shows timestamps in the original timezone (either committer’s or author’s).

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

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