GIT存储日期 [英] GIT stashed date

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

问题描述



  $ git存储列表
存储@ {0}:解决方法:动画修复了
stash @ {1}:在WIP上:62aecaa合并来自SOURCE / branch-name的请求#10

是否有任何方法可以拥有相同的列表,但包括创建存储的日期?

解决方案

存储条目只是内部的常规git提交。因此,您可以阅读它的日期(提交日期或作者日期)以知道它的创建时间。

正如 git stash ,你可以在调用 git stash list 时使用格式化选项 git log >。因此,要获得日期,您可以使用 git log 的选项 - format

  git stash list --format =%gd:%ci  - %gs

这会产生如下输出:

  stash @ {0}:2014 -04-23 11:36:39 +0500  - 在主人的WIP上:d072412做一些事情

格式使用%ci ,它以ISO 8601格式打印提交者日期。相对日期使用%cr

 存储@ {0}: 8分钟前 -  WIP on master:d072412做些什么

请参阅 git log 的联机帮助页面(PRETTY FORMATS)以获得更多格式化选项。

Given the following stash content:

$ git stash list
stash@{0}: On fixes: animations-fixes
stash@{1}: WIP on master: 62aecaa Merge pull request #10 from SOURCE/branch-name

is there any way to have the same list, but including the date on which the stash was created?

解决方案

A stash entry is just a regular git commit internally. So you can read its date ("commit date" or "author date") to know when it was created.

As mentioned in the manpage of git stash, you can use the formatting options for git log when invoking git stash list. So to get the date, you could use git log's option --format:

git stash list --format="%gd: %ci - %gs"

This produces output like:

stash@{0}: 2014-04-23 11:36:39 +0500 - WIP on master: d072412 Do some stuff

That format uses %ci, which prints the committer date in ISO 8601 format. Use %cr for relative dates:

stash@{0}: 8 minutes ago - WIP on master: d072412 Do some stuff

See the manpage of git log (section "PRETTY FORMATS") for more formatting options.

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

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