开发者

How to truncate field in git log --pretty

开发者 https://www.devze.com 2023-04-13 07:03 出处:网络
We have some people with long names in our git commit logs.Currently, my format is pretty = %C(yellow)%h%Creset %s %C(red)(%an, %cr)%Creset

We have some people with long names in our git commit logs. Currently, my format is

pretty = %C(yellow)%h%Creset %s %C(red)(%an, %cr)%Creset

which shows

276840c Kyle Heironimus Added updated hello world example. (3 months ago)

I really just want

276840c Kyle Added updated hello world example. (3 months ago)

开发者_如何转开发If I can't just take the first word of the author name, the first 5 characters would be my second choice.

Any way to do this?


If you use %aN rather than %an, Git will consider aliases listed in ~/.mailmap when displaying author names. If you create that file, and add, say -

Kyle <youremail@example.com>

then you should get the desired output.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号