How to wrap git commit comments?

后端 未结 15 1961
野性不改
野性不改 2020-12-01 01:01

Is there a way to wrap git commit comments (when viewed via git log), so they are not cut off at the end of the line? It seems like there should be a pretty sim

15条回答
  •  情歌与酒
    2020-12-01 01:12

    At least in git version 1.7.9.5, git log does support line wrapping. From git help log:

     PRETTY FORMATS
       %w([[,[,]]]): switch line wrapping
    

    So, for example, the following wraps the long subjects at 72 columns:

    alias gl='git log --format="%C(yellow)%h %an %ad%C(reset)%n%w(72,1,2)%s"'
    

    (Agreed that commit formatting conventions should be followed instead of relying on this. However, this might prove useful until the day comes when everybody knows and respects the conventions.)

提交回复
热议问题