Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How could I find lengthy commit messages?

Tags:

git

I have this idea that the more keystrokes expended to decorate a commit, the more likely it is that useful thoughts are embedded in that commit. How might I find these? A commit with a single line, merely a subject, is not worth seeking out:

ran updated format rules

Whereas a commit like this might be worth encountering:

changed fetch of base64 images

Changed the way we return base64 images when fetching for content because when we clear out the deleted image form s3 and update the content with a empty key it causes an exception trying fetch base64 images with an invalid key.

This is because the actual database delete happens after we have returned response to MSC. Ideally we could move the delete to project theseus and then no longer do the db call on the MSC side. For now this should work.

How could I retrieve a list of such commits from the git log?

like image 591
djeikyb Avatar asked Oct 15 '25 16:10

djeikyb


2 Answers

git rev-list --all | git cat-file --batch-check | sort -nk3

or instead of the sort you could do something like

git rev-list --all | git cat-file --batch-check \
| awk '$3 > 300 {print $1}' | git log --no-walk --stdin
like image 81
jthill Avatar answered Oct 17 '25 05:10

jthill


Welp I finally broke down and wrote a thing, copied here:

#!/bin/sh

countWords() {
    commit="$1"
    word_count=$(git show --format='%B' --no-patch "$commit" | wc -w)
    auth="$(git show --format='%h %aN / %cN' --no-patch $commit)"
    echo "$word_count $auth"
    exit 0
}

[ -n "$2" ] && countWords "$2"

range="origin/master"
[ -n "$1" ] && range="origin/master~$1..origin/master" 

echo "$range"

git log --format='%H' "$range" | xargs -I{} -P 16 $0 --last "{}"

To get the word count of the last ten commits:

git wc 10

To get the word count of all commits:

git wc
like image 25
djeikyb Avatar answered Oct 17 '25 06:10

djeikyb



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!