虽然我在提交消息中添加了 Co-authored-by: ,git log --name-only但只显示一位作者,而不显示其他作者,我怎样才能让 git 显示共同作者呢?
你可以,因为它是预告片:
git log --format="%h %s %an Co-author:%(trailers:key=Co-authored-by)"
Run Code Online (Sandbox Code Playgroud)
虽然 Git 确实对此一无所知,但预告片方案允许将任何key=value您想要的内容添加到提交消息中。
从Git 2.32(2021 年第 2 季度)开始,您可以使用任何您想要的预告片进行提交。
git commit --trailer "Signed-off-by:C O Mitter <committer@example.com>" \
--trailer "Helped-by:C O Mitter <committer@example.com>"
Run Code Online (Sandbox Code Playgroud)