You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何修改git for-each-ref中committerdate的输出格式?

修改git for-each-ref的提交日期输出格式

你可以通过在%(committerdate)后添加:format参数来自定义日期输出格式,直接指定目标格式字符串即可。

修改后的完整命令如下:

git for-each-ref --sort='-committerdate' refs/remotes --format='"%(refname)",%(committerdate:format="%b %d %Y %H:%M:%S %z")',"%(authorname)"' > branches.csv

格式参数说明:

  • %b:月份缩写(如Jan、Feb)
  • %d:日期(自动处理前导空格/零,输出如7、07)
  • %Y:四位年份
  • %H:%M:%S:24小时制的时分秒
  • %z:时区偏移(如-0700)

执行该命令后,committerdate将输出为你需要的Jan 7 2021 15:45:35 -0700格式。

内容的提问来源于stack exchange,提问作者MB34

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.05 20:15:42