GIT-COMMENT(7) Miscellaneous Information Manual GIT-COMMENT(7) NAME git-comment – add comments from commit messages SYNOPSIS git comment [--all] [--comment-start string] [--comment-lead string] [--comment-end string] [--min-group lines] [--min-repeat lines] [--no-repeat] [--pretty format] [options ...] [--] file DESCRIPTION The git-comment command adds comments to a file showing the commit messages which last modified each group of lines. By default only commit messages with bodies and which modified groups of at least 2 lines are added. Each comment contains the abbreviated commit hash and the commit summary, followed by the commit body. git-comment accepts all the options of git-blame(1) in addition to the following: --all Include all commit messages. The default is to include only commit messages with bodies (lines after the summary). --comment-start string Start comments with string. The default is the value of comment.start or ‘/*’. --comment-lead string Continue comments with the leading string. The default is the value of comment.lead or ‘ *’. --comment-end string End comments with string. The default is the value of comment.end or ‘ */’. --min-group lines Add comments only for groups of at least lines. The default is 2 lines. --min-repeat lines Avoid repeating a comment if it occurred in the last lines. The default is 30 lines. --no-repeat Avoid repeating comments entirely. --pretty format Set the pretty-print format to use for commit messages. The default is the value of comment.pretty or ‘format:%h %s%n%n%-b’. See git-show(1). EXAMPLES For files with ‘#’ comments: git config comment.start '#' git config comment.lead '#' git config comment.end '' Add as many comments as possible: git comment --all --min-group 1 --min-repeat 1 Some examples of output from catgirl(1): /* 347e2b4 Don't apply uiThreshold to Network and Debug * * Messages don't really need to be hidden from and I think * it could be confusing. Debug messages are all Cold so everything * would be hidden, and I want to keep them that way so that * doesn't clutter the status line needlessly. */ if (id == Network || id == Debug) { window->thresh = Cold; } else { window->thresh = uiThreshold; } /* b4c26a2 Measure timestamp width using ncurses * * This allows for non-ASCII characters in timestamps, and simplifies * things by including the trailing space in the width. */ int y; char buf[TimeCap]; struct tm *time = localtime(&(time_t) { -22100400 }); size_t len = strftime(buf, sizeof(buf), uiTime.format, time); if (!len) errx(EX_CONFIG, "invalid timestamp format: %s", uiTime.format); waddstr(main, buf); waddch(main, ' '); getyx(main, y, uiTime.width); (void)y; /* 43b1dba Restore toggling ignore with M-- * * So that pressing M-- repeatedly maintains the previous behavior. */ if (n < 0 && window->thresh == Ice) { window->thresh = Cold; } else { window->thresh += n; } /* 1891c77 Preserve colon from previous tab-complete * * This fixes the case when pinging multiple nicks and one of them needs to * be cycled through. */ bool colon = (tab.len >= 2 && buf[tab.pos + tab.len - 2] == L':'); SEE ALSO https://git.causal.agency/src/tree/bin/git-comment.pl AUTHORS june In case it's unclear, this is a git(1) subcommand I wrote. Did you know you can add new git(1) subcommands just by adding executables named git-* to somewhere in PATH? This is also, I think, my third Perl script ever. It's an interestingly shaped language. Quite neat. Causal Agency September 10, 2021 Causal Agency