传递日期的语法有规范吗 混帐?例如,什么日期被接受 “git rev-list”的“--before”选项?
假设没有这样的规范,有没有 让 git 将日期转换为规范日期的方法 形式,以便可以检查给定的日期字符串 被解释为人们所期望的吗? (更新:我已经 写了一个脚本来做这个,这是可用的 here .)
信息说明:日期解析似乎已实现 在文件 date.c 中,在 git 存储库的根目录中。 “入口点”似乎是一个名为 approxidate_careful.
最佳答案
据我所知,它没有在任何地方明确指出,但它似乎接受它可以输出的所有格式,如 --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
shows dates relative to the current time, e.g. "2 hours ago".
--date=local
shows timestamps in user’s local timezone.
--date=iso
(or--date=iso8601
) shows timestamps in ISO 8601 format.
--date=rfc
(or--date=rfc2822
) shows timestamps in RFC 2822 format, often found in E-mail messages.
--date=short
shows only date but not time, inYYYY-MM-DD
format.
--date=raw
shows the date in the internal raw git format%s %z
format.
--date=default
shows timestamps in the original timezone (either committer’s or author’s).
关于git - git 日期语法规范,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14023794/