如何通过哈希显示提交的日期和时间 [英] How to show date and time of a commit by hash
问题描述
在创建特定分支时,我使用git reflog
标识哈希值.我得到了fe1ddcdef
的哈希.我还没有将此分支推送到远程.我现在正在尝试查找fe1ddcdef
发生的日期和时间. git reflog
仅显示我:
I used git reflog
to identify a hash for when I created a particular branch. I got the hash of fe1ddcdef
. I haven't pushed this branch to the remote yet. I'm now trying to find the date and time for when fe1ddcdef
took place. git reflog
only shows me:
fe1ddcdef HEAD@{11}: checkout: moving from master to handoff
没有日期或时间.
git log
太冗长了,因为它包含了我所有同事的提交,并且我很难在那堆干草堆中找到fe1ddcdef
的内容.
git log
is far too verbose, since it contains commits from all of my colleagues and I can't easily find the needle of fe1ddcdef
in that haystack.
我怎样才能简单地找到提交fe1ddcdef
的日期和时间?
How can I simply find the date and time of commit fe1ddcdef
?
推荐答案
只需使用:
git show fe1ddcdef
…显示提交的内容.实际上,一旦有了用于标识提交对象的任何表达式,就可以在需要修订的所有地方使用它.这些表达式可以是十六进制哈希(偶数),分支名称或标记名称.它也可以是其中之一,与一个或多个运算符(例如"^",〜"或"@")相关联.
… to display the content of the commit. Actually, once you have any expression that identifies a commit object, you can use it in all places that require a revision. These expressions can be an hexadecimal hash (even partial), a branch name or a tag name. It can also be one of these, associated to one or many operators such as "^", or "~", or "@".
这意味着您还可以使用git log fe1ddcdef
从此点开始获取分支的完整历史记录.
This means that you can also use git log fe1ddcdef
to get the full history of the branch starting from this point.
如果只想获取日期和时间,而没有其他内容,则可以输入:
If you want to get only date and time of it and nothing else, you can type :
git show --no-patch --no-notes --pretty='%cd' fe1ddcdef
用'%h %cd %s'
替换'%cd'
以添加哈希摘要和提交的主题消息.
Replace '%cd'
by '%h %cd %s'
to add hash summary and commit's subject message.
这篇关于如何通过哈希显示提交的日期和时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!