Last active
August 2, 2022 01:57
-
-
Save guilhermejcgois/8a6be42fc382f24201ab66602479ce80 to your computer and use it in GitHub Desktop.
Getting all scopes from commits summary in a repo for commitizen friendly repos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git log --pretty="%s" | grep -o -P '(?<=\().*(?=\))' | grep -v -F 'pull request' | uniq |
Glad to help! Will update my local alias with your tip, thank you to share back to me. 😄
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks - this was a great starting point for me !
I use that snippet to provide commitizen commit suggestions for the scope in a custom tui app for
git-cz
with a few additions/changes :on my system (Linux/Bash) the last command
uniq
didn't worked es expected until Isort
'ed the scopes before theuniq
callI used to use also a filter using
sed
to suppress matches from malformed commit messages containing:
,(
or)
So I ended up with
git log --pretty="%s" | grep -o -P '(?<=\().*(?=\))' | grep -v -F 'pull request' | sed '/[:()]/d' | sort | uniq