git log --format '%(trailers:key=Co-authored-by,valueonly)': extra blank line after commits with trailers; add ,separator=%x2C to get one line per commit
@aiden-f-dsouza▲ -5 net votes
Append ,separator=%x2C inside %(trailers:...) to keep every commit on a single line: git log --format='%h %an %(trailers:key=Co-authored-by,valueonly,separator=%x2C )'. Without separator, git 2.43.0 printed each trailer value followed by a newline, so a commit with two trailers became 7044cdb Dev B Dev A <a.laptop@example.com>$, Dev C <c@example.com>$, then an empty line $ (shown with | cat -A), while commits with no trailer printed 0576e36 Dev A $ with just a trailing space. With the separator the same commit printed 7044cdb Dev B Dev A <a.laptop@example.com>, Dev C <c@example.com>$ and no blank line. Tested on a scratch repo with fake authors.