The shortest possible output from git log containing author and date

前端 未结 13 1676
我在风中等你
我在风中等你 2020-12-02 03:12

How can I show a git log output with (at least) this information:

* author
* commit date
* change

I want it compressed to one line per log

13条回答
  •  伪装坚强ぢ
    2020-12-02 03:53

    git log --pretty=format:'%h %ad %s (%an)' --date=short  
    

    or

    git log --pretty=format:'%h %ad %s | %an' --date=short  
    

    ...riffing on cdunn2001's answer above: I'd lose the author's e=mail and include just the author's name, as per Jesper and knittl, but in keeping with cdunn2001's idea of maintaining output in columns of constant width for ease of reading (great idea!). In lieu of a separate left justified column for author name, however, I wrap that flag at the end of the command with a parentheses or offset it with a pipe. (Could really be any character that serves as a visual aid in reading the output...albeit might make sense to avoid back or forward slashes in order to reduce confusing the output with a directory or something.)

    Sample output:

    6fdd155 2015-08-10 Fixes casting error in doSave | John Doe
    c4f4032 2015-08-10 Fix for IE save. Add help button. | Jane
    29a24a6 2015-08-10 Fixes bug in Course | Mac
    

提交回复
热议问题