git - 在本地时区以 YYYY-MM-DD 格式检索 git 日志

标签 git

要获取日期的 YYYY-MM-DD 格式,使用 git log --date=iso。 要强制使用本地时区的日期,使用 git log --date=local

我试图将这两个选项结合起来,但失败了。 那么有没有一种方法(git log 命令)可以获取本地时区的日期(YYYY-MM-DD 格式)?

最佳答案

对于 git 2.7,使用:

git log  --date=iso-local

git 2.7(2015 年第 4 季度),引入了 -local 作为指令。

这意味着,除了:

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

您还将拥有:

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

您现在可以使用本地时区请求任何日期格式。


参见 commit 99264e9 , commit db7bae2 , commit dc6d782 , commit f3c1ba5 , commit f95cecf , commit 4b1c5e1 , commit 8f50d26 , commit 78a8441 , commit 2df4e29 (2015 年 9 月 3 日)作者 John Keeping (johnkeeping) .
参见 commit add00ba , commit 547ed71 (2015 年 9 月 3 日)作者 Jeff King (peff) .
(由 Junio C Hamano -- gitster -- merge 于 commit 7b09c45 ,2015 年 10 月 5 日)

参见 git log date format 了解更多。

关于git - 在本地时区以 YYYY-MM-DD 格式检索 git 日志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17910312/

相关文章:

git - 我怎么能责怪 Git 中删除的文件?

git - 如何将 master 分支的内容移动到新的 Git 分支?

git - 如何将 $HOME/opt/git/bin 放入我的 PATH?

Git gc 失败并显示 : Error pack-objects died of signal 9

git - 在开始使用 Git 之前,我应该了解什么?

git - 为什么我在 git checkout 时收到文件丢失的错误?

git - git push.default=current 和 push.default=upstream 有什么区别?

git - 为什么最近, git rebase -i squash 导致头部分离

ios - git push 说一切都是最新的

git push 到远程主分支