git 获取存储的创建日期
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15551618/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Get the creation date of a stash
提问by Jason
Is there a way to tell when a stash was created?
有没有办法知道什么时候创建了一个 stash?
git stash list
only lists the stashes, and git stash show XXXXXX
shows all the files and changes, but not the dateof the stash creation.
git stash list
仅列出存储,并git stash show XXXXXX
显示所有文件和更改,但不显示存储创建日期。
回答by Igor
Try:
尝试:
git stash list --date=local
It should print something like:
它应该打印如下内容:
stash@{Thu Mar 21 10:30:17 2013}: WIP on master: 2ffc05b Adding resource
回答by Lee Netherton
You can use --pretty=format
to achieve this. For example, this produces a stash list that includes a relative time:
您可以使用它--pretty=format
来实现这一点。例如,这会生成一个包含相对时间的存储列表:
git stash list --pretty=format:"%C(red)%h%C(reset) - %C(dim yellow)(%C(bold magenta)%gd%C(dim yellow))%C(reset) %<(70,trunc)%s %C(green)(%cr) %C(bold blue)<%an>%C(reset)"
I have this set in the [alias]
section of my ~/.gitconfig
file, so that I can bind it to a simple sl
command:
我在[alias]
我的~/.gitconfig
文件部分设置了这个,以便我可以将它绑定到一个简单的sl
命令:
[alias]
co = checkout
lg = log --graph --pretty=format:\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset\" --abbrev-commit
rl = reflog --pretty=format:\"%Cred%h%Creset %C(auto)%gd%Creset %C(auto)%gs%C(reset) %C(green)(%cr)%C(reset) %C(bold blue)<%an>%Creset\" --abbrev-commit
sl = stash list --pretty=format:\"%C(red)%h%C(reset) - %C(dim yellow)(%C(bold magenta)%gd%C(dim yellow))%C(reset) %<(70,trunc)%s %C(green)(%cr) %C(bold blue)<%an>%C(reset)\"
(You can see that I also have similar markups for log
and reflog
)
(你可以看到我也有类似的标记log
和reflog
)
If you want to show the actual date, rather than a relative time then replace %(cr)
with %(ci)
.
如果要显示实际日期,而不是相对时间,请替换%(cr)
为%(ci)
.
回答by bcmcfc
git show stash@{0}
also prints out the date, along with the other information.
git show stash@{0}
还会打印出日期以及其他信息。