我希望在合并后收到一个漂亮可读的新提交列表,而不是默认的已更改文件列表。看起来像:
[21.05.13 10:03] User Superuser <his@mail.com>: f56dc3db33f7bae45edb48e4f051859d469a8f37
Fixed something
[23.05.13 10:03] User Duperuser <his@mail.net>: cb3fd7312ec6d712f8fcff27b508f74799f645b4
Merge remote branch 'origin/master' into duperbranch
我将使用post-merge
挂钩,但是我是否找到了未合并的最新提交消息?
答案 0 :(得分:2)
要获得合并的提交,我会做这样的事情:
#!/usr/bin/env zsh
parents=( $( git show --pretty=%P $1 ) )
# First is branch we merged into, rest are parents which were merged.
echo First: $parents[1]
echo Rest: $parents[2,-1]
# For each parent we merged in get commits that are new to original HEAD.
for p in $parents[2,-1]
do
git log $parents[1]..$p
done
使用./script.sh $commit
运行此功能,在您的情况下,只需将$1
替换为HEAD
即可。
您可以尝试使用漂亮的打印日志选项来获得您喜欢的内容。