有没有办法知道什么时候创建了藏匿点?
git stash list只列出了存储,而git stash show XXXXXX显示了所有的文件和更改,但不包括创建存储的日期。
git stash list
git stash show XXXXXX
试一试:
git stash list --date=local
它应该打印如下内容:
stash@{Thu Mar 21 10:30:17 2013}: WIP on master: 2ffc05b Adding resource
git show stash@{0}还输出日期和其他信息。
git show stash@{0}
你可以使用--pretty=format来实现这一点。例如,这会生成一个包含相对时间的隐藏列表:
--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)"
我在我的~/.gitconfig文件的[alias]部分设置了这个值,这样我就可以将它绑定到一个简单的sl命令:
~/.gitconfig
[alias]
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)\"
(你可以看到我对log和reflog也有类似的标记)
log
reflog
如果你想显示实际日期,而不是相对时间,那么用%(ci)替换%(cr)。
%(ci)
%(cr)