git commit-message-key-lines

Show the commit’s keyword-marker lines

Git alias:

commit-message-key-lines = "!f(){ \
    echo \"Commit: $1\"; git log \"$1\" --format=fuller | \
    grep \"^[[:blank:]]*[[:alnum:]][-[:alnum:]]*:\" | \
    sed \"s/^[[:blank:]]*//; s/:[[:blank:]]*/: /\"; \
}; f"

Example:

git commit-message-key-lines ce505d161fccdbc8d4bf12047846de7433ad6d04

Show each line in the commit message that starts with optional whitespace, then a keyword (i.e. alphanum and dash characters), then a colon. The purpose is to help with analytics and reports.

Example commit and message:

commit ce505d161fccdbc8d4bf12047846de7433ad6d04
Author: Alice Adams <alice@example.com>
Date:   Tue May 28 11:53:47 2019 -0700

    Add feature foo

    This commit does some good things.

    Time: 8 hours
    Cost: 800 USD

Example command:

git commit-message-key-lines ce505d161fccdbc8d4bf12047846de7433ad6d04

Example output:

`grave;`grave;`grave;shell Commit: ce505d161fccdbc8d4bf12047846de7433ad6d04 Author: Alice Adams Date: Tue May 28 11:53:47 2019 -0700 Time: 8 hours Cost: 800 USD

The alias intentionally normalizes the output:

Known issues: