5 ms·
Some nice ideas but the regexes should include word boundaries. For example: git log -i -E --grep="\b(fix|fixed|fixes|bug|broken)\b" --name-only --format='' |
by JetSetIlly 6mo ago
Some nice ideas but the regexes should include word boundaries. For example:
git log -i -E --grep="\b(fix|fixed|fixes|bug|broken)\b" --name-only --format='' | sort | uniq -c | sort -nr | head -20
I have a project with a large package named "debugger". The presence of "bug" within "debugger" causes the original command to go crazy.
- grepsedawk 6mo agoGood catch, that's better
- nozzlegear 6mo agoThis needs a small tweak to work on macOS, where git uses the POSIX version of grep (which doesn't support `\b`). You need to use the Perl Regexp option by switching -E with -P: git log -i -P --grep="\b(fix|fixed|fixes|bug|broken)\b" --name-only --format='' | sort | uniq -c | gsort -nr | head -20
- grepsedawk 6mo agoGood catch. The word boundary syntax isn't portable across platforms. I reverted to the simpler version that works everywhere.
- j2kun 6mo agoSimilarly, we have a technical concept called "rollback" that is unrelated to a reverted commit.
- Timwi 6mo agoWord boundaries are one way to address that, but they require you to list all the inflections (and you missed “fixing”). Another way is to say (?<!de)bug.