git: changelog day by day

后端 未结 5 754
无人及你
无人及你 2020-12-23 22:23

How to generate changelog of commits groupped by date, in format:

[date today]
- commit message1
- commit message2
- commit message3
...
[date day+3]
- commi         


        
5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-23 22:37

    I couldn't get the accepted answer to handle today's commits as my setup didn't handle the NEXT variable properly on the first iteration. Git's log parameters will accept a time too, which removes the need for a NEXT date:

    #!/bin/bash
    # Generates changelog day by day
    echo "CHANGELOG"
    echo ----------------------
    git log --no-merges --format="%cd" --date=short | sort -u -r | while read DATE ; do
        echo
        echo [$DATE]
        GIT_PAGER=cat git log --no-merges --format=" * %s" --since="$DATE 00:00:00" --until="$DATE 24:00:00"
    done
    

提交回复
热议问题