git - 如何根据 blob/tree hash 发现最近的相关提交?

标签 git

如果我 ls-tree 某棵树并获得 blob 和树的列表,我如何才能发现与这些 blob 和树相关的最后一次提交?我正在寻找这样的东西:

$ git ls-tree HEAD
...
100644 blob  734713bc047d87bf7eac9674765ae793478c50d3   myfile
...
$ git show --commit 734713bc047d87bf7eac9674765ae793478c50d3
commit 734713bc047d87bf7eac9674765ae793478c50d3
Author: Scott Chacon <schacon@gmail.com>
Date:   Fri Jan 2 18:32:33 2009 -0800

    fixed refs handling, added gc auto, updated tests

最佳答案

我有点困惑。我不明白你为什么需要这样的东西。但是,我认为这就是你想要的-

git ls-tree --name-only HEAD | while read file; do git log -n 1 --date=short --pretty="$file, author: %an, commit: %h, date: %ad, msg: '%s'" -- $file; done

关于git - 如何根据 blob/tree hash 发现最近的相关提交?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10585816/

相关文章:

r - 我应该 (git) 忽略我的 knitr 缓存吗?

git - 如何检查存储库是否是裸的?

混帐 : Merge multiple commits from one branch into another

git - 在 reflog 过期和 gc prune 后推送到源

git - 关于 git 中常规提交消息的问题

svn - git-svn 可以像本地颠覆客户端一样处理 CRLF 吗?

git - 如何在egit中添加和编辑注释

git - 我可以根据 URL 对 Git 存储库使用不同的作者信息吗

git - 如何在git中 merge 和更新文件时解决冲突?

c# - 在 C# 上使用 SSH 进行 NGit(JGit 端口)身份验证