简体   繁体   中英

`git log --name-only` show coauthors

虽然我添加了 Co-authored-by: 在提交消息中, git log --name-only只显示一个作者,而不是其他作者,但我怎样才能让 git 显示共同作者?

You can, in that it is a trailer :

git log --format="%h %s %an Co-author:%(trailers:key=Co-authored-by)"

While it is true Git knows nothing about it, the trailer scheme allows to add any key=value you want to the commit message.

Since Git 2.32 (Q2 2021), you can make a commit with any trailer you want.

git commit --trailer "Signed-off-by:C O Mitter <committer@example.com>" \
           --trailer "Helped-by:C O Mitter <committer@example.com>"

how can I make git show the coauthors

You can't. Git commits don't have coauthors. There is a GitHub coauthor feature, and other hosting milieus may support that sort of thing too; but Git itself knows nothing of it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM