如何显示提交消息以及blame命令?

时间:2017-05-25 09:38:37

标签: git

我有以下命令来显示特定

的指责信息

git blame -L 11,13 <file-path>

但它不会给我提交消息,我必须运行另一个命令,可能是git show <hash>来获取提交消息。

提交消息在这里很重要,因为我不需要知道是谁做了这些更改,但也为什么。

我尝试了git log --date=iso -L 11,13:<file-path> --format="%h %an %ad %s",看起来不错,但显示了太多细节差异信息,而且我不需要这么多信息。

以下是我的要求:

  1. commit hash
  2. 作者
  3. 作者日期
  4. 提交消息
  5. 更新内容

1 个答案:

答案 0 :(得分:0)

git blame -L 11,13 <file-path> | while read hash others;
do
    echo $hash $others "|Subject:" $(git log -1 --pretty=%s $hash)
done
相关问题