Forked from qoomon/conventional-commits-cheatsheet.md
Created
January 6, 2023 14:32
-
-
Save sh00pdx/cdb4c07e57047cd559382cacf9a92500 to your computer and use it in GitHub Desktop.
Revisions
-
qoomon revised this gist
Oct 26, 2022 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -46,6 +46,7 @@ The `scope` provides additional contextual information. The `subject` contains a succinct description of the change. * Is a **mandatory** part of the format * Use the imperative, present tense: "change" not "changed" nor "changes" * Think of `This commit will <subject>` * Don't capitalize the first letter * No dot (.) at the end -
qoomon revised this gist
Apr 7, 2022 . 1 changed file with 3 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ # Conventional Commit Messages See how a minor change to your commit message style can make a difference. [Examples](#examples) **Have a look at CLI util [git-conventional-commits](https://github.com/qoomon/git-conventional-commits) to ensure this conventions and generate changelogs** @@ -22,21 +22,13 @@ Merge branch '<b><branch name></b>' </pre> <sup>Follows default git merge message</sup> ### Types * API relevant changes * `feat` Commits, that adds a new feature * `fix` Commits, that fixes a bug * `refactor` Commits, that rewrite/restructure your code, however does not change any behaviour * `perf` Commits are special `refactor` commits, that improve performance * `style` Commits, that do not affect the meaning (white-space, formatting, missing semi-colons, etc) * `test` Commits, that add missing tests or correcting existing tests * `docs` Commits, that affect documentation only @@ -132,7 +124,6 @@ The `footer` should contain any information about **Breaking Changes** and is al commit_msg_subject_regex='.{1,100}' commit_msg_regex="^(${commit_msg_type_regex})(\(${commit_msg_scope_regex}\))?: (${commit_msg_subject_regex})\$" merge_msg_regex="^Merge branch '.+'\$" zero_commit="0000000000000000000000000000000000000000" @@ -155,7 +146,7 @@ The `footer` should contain any information about **Breaking Changes** and is al for commit in $rev_span; do commit_msg_header=$(git show -s --format=%s $commit) if ! [[ "$commit_msg_header" =~ (${commit_msg_regex})|(${merge_msg_regex}) ]]; then echo "$commit" >&2 echo "ERROR: Invalid commit message format" >&2 echo "$commit_msg_header" >&2 -
qoomon revised this gist
Aug 6, 2021 . 1 changed file with 0 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -97,11 +97,6 @@ The `footer` should contain any information about **Breaking Changes** and is al * ``` style: remove empty line ``` ## Git Hook Scripts to ensure commit message header format -
qoomon revised this gist
Apr 12, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -86,7 +86,7 @@ The `footer` should contain any information about **Breaking Changes** and is al The error occurred because of <reasons>. ``` * ``` build(release): bump version to 1.0.0 ``` * ``` build: update dependencies -
qoomon revised this gist
Apr 12, 2021 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -42,6 +42,7 @@ This reverts commit <b><commit hash></b>. * `docs` Commits, that affect documentation only * `build` Commits, that affect build components like build tool, ci pipeline, dependencies, project version, ... * `ops` Commits, that affect operational components like infrastructure, deployment, backup, recovery, ... * `chore` Miscellaneous commits e.g. modifying `.gitignore` ### Scopes The `scope` provides additional contextual information. -
qoomon revised this gist
Apr 12, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -39,7 +39,7 @@ This reverts commit <b><commit hash></b>. * `perf` Commits are special `refactor` commits, that improves performance * `style` Commits, that do not affect the meaning (white-space, formatting, missing semi-colons, etc) * `test` Commits, that add missing tests or correcting existing tests * `docs` Commits, that affect documentation only * `build` Commits, that affect build components like build tool, ci pipeline, dependencies, project version, ... * `ops` Commits, that affect operational components like infrastructure, deployment, backup, recovery, ... -
qoomon revised this gist
Jan 15, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -36,7 +36,7 @@ This reverts commit <b><commit hash></b>. * `feat` Commits, that adds a new feature * `fix` Commits, that fixes a bug * `refactor` Commits, that rewrite/restructure your code, however does not change any behaviour * `perf` Commits are special `refactor` commits, that improves performance * `style` Commits, that do not affect the meaning (white-space, formatting, missing semi-colons, etc) * `test` Commits, that add missing tests or correcting existing tests * `doc` Commits, that affect documentation only -
qoomon revised this gist
Dec 30, 2020 . No changes.There are no files selected for viewing
-
qoomon revised this gist
Dec 30, 2020 . 1 changed file with 9 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -110,8 +110,15 @@ The `footer` should contain any information about **Breaking Changes** and is al ```shell #!/usr/bin/env sh commit_message="$1" # exit with a non zero exit code incase of an invalid commit message # use git-conventional-commits, see https://github.com/qoomon/git-conventional-commits git-conventional-commits commit-msg-hook "$commit_message" # or verify $commit_message with your own tooling # ... ``` * ⚠ make `.git-hooks/commit-msg` executable (unix: `chmod +x '.git-hooks/commit-msg'`) * set git hook directory to `.githooks` `git config core.hooksPath '.git-hooks'` -
qoomon revised this gist
Sep 12, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ # Conventinal Commit Messages See how a minor change to your commit message style can make a difference. [Examples](#examples) **Have a look at CLI util [git-conventional-commits](https://github.com/qoomon/git-conventional-commits) to ensure this conventions and generate changelogs** <img src="https://img.icons8.com/dusk/1600/commit-git.png" width="200" height="200" /> -
qoomon revised this gist
Sep 12, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ # Conventinal Commit Messages See how a minor change to your commit message style can make a difference. [Examples](#examples) **Have a look at CLI Util [git-conventional-commits](https://github.com/qoomon/git-conventional-commits) to ensure this conventions and generate changelogs** <img src="https://img.icons8.com/dusk/1600/commit-git.png" width="200" height="200" /> -
qoomon revised this gist
Apr 17, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -41,7 +41,7 @@ This reverts commit <b><commit hash></b>. * `test` Commits, that add missing tests or correcting existing tests * `doc` Commits, that affect documentation only * `build` Commits, that affect build components like build tool, ci pipeline, dependencies, project version, ... * `ops` Commits, that affect operational components like infrastructure, deployment, backup, recovery, ... ### Scopes The `scope` provides additional contextual information. -
qoomon revised this gist
Sep 26, 2019 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@ # Conventinal Commit Messages See how a minor change to your commit message style can make a difference. [Examples](#examples) Have a look at CLI Util [git-conventional-commits](https://github.com/qoomon/git-conventional-commits) <img src="https://img.icons8.com/dusk/1600/commit-git.png" width="200" height="200" /> -
qoomon revised this gist
Sep 26, 2019 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@ # Conventinal Commit Messages See how a minor change to your commit message style can make a difference. [Examples](#examples) Have a look at CLI Util [git-conventional-commits](https://github.com/qoomon/git-conventional-commits) <img src="https://img.icons8.com/dusk/1600/commit-git.png" width="200" height="200" /> -
qoomon revised this gist
Sep 26, 2019 . 1 changed file with 3 additions and 16 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -107,22 +107,9 @@ The `footer` should contain any information about **Breaking Changes** and is al * create following file in your local repository folder`.git-hooks/commit-msg` ```shell #!/usr/bin/env sh # ensure https://github.com/qoomon/git-conventional-commits is installed git-conventional-commits commit-msg-hook "$1" ``` * ⚠ make `.git-hooks/commit-msg` executable (unix: `chmod +x '.git-hooks/commit-msg'`) * set git hook directory to `.githooks` `git config core.hooksPath '.git-hooks'` -
qoomon revised this gist
Jul 1, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -64,7 +64,7 @@ The `body` should include the motivation for the change and contrast this with p The `footer` should contain any information about **Breaking Changes** and is also the place to **reference Issues** that this commit refers to. * Is an **optional** part of the format * **optionally** reference an issue by its id. * **Breaking Changes** should start with the word `BREAKING CHANGES:` followed by space or two newlines. The rest of the commit message is then used for this. ### Examples -
qoomon revised this gist
Jul 1, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -64,7 +64,7 @@ The `body` should include the motivation for the change and contrast this with p The `footer` should contain any information about **Breaking Changes** and is also the place to **reference Issues** that this commit refers to. * Is an **optional** part of the format * **optionally** reference an issue by its id. * **Breaking Changes** should start with the word `BREAKING CHANGES:` folowed by space or two newlines. The rest of the commit message is then used for this. ### Examples @@ -75,7 +75,7 @@ The `footer` should contain any information about **Breaking Changes** and is al feat: remove ticket list endpoint refers to JIRA-1337 BREAKING CHANGES: ticket enpoints no longer supports list all entites. ``` * ``` fix: add missing parameter to service call -
qoomon revised this gist
Jul 1, 2019 . 1 changed file with 6 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -30,15 +30,16 @@ This reverts commit <b><commit hash></b>. <sup>Follows default git revert message</sup> ### Types * API relevant changes * `feat` Commits, that adds a new feature * `fix` Commits, that fixes a bug * `refactor` Commits, that rewrite/restructure your code, however does not change any behaviour * `perf` Commits are `refactor` commit, that improves performance * `style` Commits, that do not affect the meaning (white-space, formatting, missing semi-colons, etc) * `test` Commits, that add missing tests or correcting existing tests * `doc` Commits, that affect documentation only * `build` Commits, that affect build components like build tool, ci pipeline, dependencies, project version, ... * `ops` Commits, that affect operational components like infrastructure, backup, recovery, ... ### Scopes The `scope` provides additional contextual information. -
qoomon revised this gist
Jul 1, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -36,7 +36,7 @@ This reverts commit <b><commit hash></b>. * `refactor` Commits, that rewrite/restructure your code, however does not change any behaviour * `style` Commits, that do not affect the meaning (white-space, formatting, missing semi-colons, etc) * `test` Commits, that add missing tests or correcting existing tests * `doc` Commits, that affect documentation only * `build` Commits, that affect the build system or external dependencies * `ops` Commits, that affect operational components like infrastructure, backup or recovery -
qoomon revised this gist
Jun 25, 2019 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -103,7 +103,7 @@ The `footer` should contain any information about **Breaking Changes** and is al ## Git Hook Scripts to ensure commit message header format ### commit-msg Hook (local) * create following file in your local repository folder`.git-hooks/commit-msg` ```shell #!/usr/bin/env sh @@ -123,9 +123,9 @@ The `footer` should contain any information about **Breaking Changes** and is al exit 1 fi ``` * ⚠ make `.git-hooks/commit-msg` executable (unix: `chmod +x '.git-hooks/commit-msg'`) * set git hook directory to `.githooks` `git config core.hooksPath '.git-hooks'` * commit `.git-hooks` directory if you want to share them with your team, they only need to call the git config command once after cloning the repository ### pre-receive Hook (server side) * create following file in your repository folder `.git/hooks/pre-receive` -
qoomon revised this gist
May 27, 2019 . 1 changed file with 9 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -30,15 +30,15 @@ This reverts commit <b><commit hash></b>. <sup>Follows default git revert message</sup> ### Types * `feat` Commits, that adds a new feature, **recognizable by your clients** * `fix` Commits, that fixes a bug, **recognizable by your clients** * `perf` Commits, that improves performance, **recognizable by your clients** * `refactor` Commits, that rewrite/restructure your code, however does not change any behaviour * `style` Commits, that do not affect the meaning (white-space, formatting, missing semi-colons, etc) * `test` Commits, that add missing tests or correcting existing tests * `docs` Commits, that affect documentation only * `build` Commits, that affect the build system or external dependencies * `ops` Commits, that affect operational components like infrastructure, backup or recovery ### Scopes The `scope` provides additional contextual information. -
qoomon revised this gist
May 2, 2019 . 1 changed file with 4 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -103,7 +103,7 @@ The `footer` should contain any information about **Breaking Changes** and is al ## Git Hook Scripts to ensure commit message header format ### commit-msg Hook (local) * create following file in your local repository folder`.githooks/commit-msg` ```shell #!/usr/bin/env sh @@ -123,8 +123,9 @@ The `footer` should contain any information about **Breaking Changes** and is al exit 1 fi ``` * ⚠ make `.githooks/commit-msg` executable (unix: `chmod +x '.githooks/commit-msg'`) * set git hook directory to `.githooks` `git config core.hooksPath '.githooks'` * commit `.githooks` directory if you want to share them with your team, they only need to call the git config command once after cloning the repository ### pre-receive Hook (server side) * create following file in your repository folder `.git/hooks/pre-receive` -
qoomon revised this gist
Apr 30, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -124,7 +124,7 @@ The `footer` should contain any information about **Breaking Changes** and is al fi ``` * ⚠ make `.git-hooks/commit-msg` executable (unix: `chmod +x '.git-hooks/commit-msg'`) * set git hook directory to `.git-hooks` `git config core.hooksPath '.git-hooks'` ### pre-receive Hook (server side) * create following file in your repository folder `.git/hooks/pre-receive` -
qoomon revised this gist
Apr 30, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -103,7 +103,7 @@ The `footer` should contain any information about **Breaking Changes** and is al ## Git Hook Scripts to ensure commit message header format ### commit-msg Hook (local) * create following file in your local repository folder`.git-hooks/commit-msg` ```shell #!/usr/bin/env sh @@ -127,7 +127,7 @@ The `footer` should contain any information about **Breaking Changes** and is al * set commit hook directory to `.git-hooks` `git config core.hooksPath '.git-hooks'` ### pre-receive Hook (server side) * create following file in your repository folder `.git/hooks/pre-receive` ```shell #!/usr/bin/env sh -
qoomon revised this gist
Apr 30, 2019 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -103,7 +103,7 @@ The `footer` should contain any information about **Breaking Changes** and is al ## Git Hook Scripts to ensure commit message header format ### commit-msg Hook (local) * create following file `.git-hooks/commit-msg` ```shell #!/usr/bin/env sh @@ -123,10 +123,11 @@ The `footer` should contain any information about **Breaking Changes** and is al exit 1 fi ``` * ⚠ make `.git-hooks/commit-msg` executable (unix: `chmod +x '.git-hooks/commit-msg'`) * set commit hook directory to `.git-hooks` `git config core.hooksPath '.git-hooks'` ### pre-receive Hook (server side) * create following file `.git/hooks/pre-receive` ```shell #!/usr/bin/env sh @@ -173,6 +174,7 @@ The `footer` should contain any information about **Breaking Changes** and is al exit 1 fi ``` * ⚠ make `.git/hooks/pre-receive` executable (unix: `chmod +x '.git/hooks/pre-receive'`) ----- ## References -
qoomon revised this gist
Apr 30, 2019 . 1 changed file with 2 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -103,7 +103,7 @@ The `footer` should contain any information about **Breaking Changes** and is al ## Git Hook Scripts to ensure commit message header format ### commit-msg Hook (local) * create following file `.git-hooks/commit-msg` and ⚠ make it executable (unix: `chmod +x '.git-hooks/commit-msg'`) ```shell #!/usr/bin/env sh @@ -123,11 +123,10 @@ The `footer` should contain any information about **Breaking Changes** and is al exit 1 fi ``` * set commit hook directory to `.git-hooks` `git config core.hooksPath '.git-hooks'` ### pre-receive Hook (server side) * create following file `.git/hooks/pre-receive` and ⚠ make it executable (unix: `chmod +x '.git/hooks/pre-receive'`) ```shell #!/usr/bin/env sh -
qoomon revised this gist
Apr 30, 2019 . 1 changed file with 37 additions and 38 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -128,53 +128,52 @@ The `footer` should contain any information about **Breaking Changes** and is al ### pre-receive Hook (server side) * create following file `.git/hooks/pre-receive` ```shell #!/usr/bin/env sh # Pre-receive hook that will block commits with messges that do not follow regex rule commit_msg_type_regex='feat|fix|refactor|style|test|docs|build' commit_msg_scope_regex='.{1,20}' commit_msg_subject_regex='.{1,100}' commit_msg_regex="^(${commit_msg_type_regex})(\(${commit_msg_scope_regex}\))?: (${commit_msg_subject_regex})\$" merge_msg_regex="^Merge branch '.+'\$" revert_msg_regex="^Revert \".+\"\$" zero_commit="0000000000000000000000000000000000000000" # Do not traverse over commits that are already in the repository excludeExisting="--not --all" error="" while read oldrev newrev refname; do # branch or tag get deleted if [ "$newrev" = "$zero_commit" ]; then continue fi # Check for new branch or tag if [ "$oldrev" = "$zero_commit" ]; then rev_span=`git rev-list $newrev $excludeExisting` else rev_span=`git rev-list $oldrev..$newrev $excludeExisting` fi for commit in $rev_span; do commit_msg_header=$(git show -s --format=%s $commit) if ! [[ "$commit_msg_header" =~ (${commit_msg_regex})|(${merge_msg_regex})|(${revert_msg_regex}) ]]; then echo "$commit" >&2 echo "ERROR: Invalid commit message format" >&2 echo "$commit_msg_header" >&2 error="true" fi done done if [ -n "$error" ]; then exit 1 fi ``` ----- ## References -
qoomon revised this gist
Apr 30, 2019 . 1 changed file with 19 additions and 19 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -104,25 +104,25 @@ The `footer` should contain any information about **Breaking Changes** and is al ### commit-msg Hook (local) * create following file `.git-hooks/commit-msg` ```shell #!/usr/bin/env sh # commit-msg hook that will ensure commit messge format commit_msg_type_regex='feat|fix|refactor|style|test|docs|build|ops' commit_msg_scope_regex='.{1,20}' commit_msg_subject_regex='.{1,100}' commit_msg_regex="^(${commit_msg_type_regex})(\(${commit_msg_scope_regex}\))?: (${commit_msg_subject_regex})\$" merge_msg_regex="^Merge branch '.+'\$" revert_msg_regex="^Revert \".+\"\$" commit_msg_header=$(head -1 $1) if ! [[ "$commit_msg_header" =~ (${commit_msg_regex})|(${merge_msg_regex})|(${revert_msg_regex}) ]]; then echo "ERROR: Invalid commit message format" >&2 echo "\n$commit_msg_header" >&2 exit 1 fi ``` * ⚠ make `.git-hooks/commit-msg` executable (unix: `chmod +x .git-hooks/commit-msg`) * set commit hook directory to `.git-hooks` `git config core.hooksPath '.git-hooks'` -
qoomon revised this gist
Apr 30, 2019 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -103,7 +103,7 @@ The `footer` should contain any information about **Breaking Changes** and is al ## Git Hook Scripts to ensure commit message header format ### commit-msg Hook (local) * create following file `.git-hooks/commit-msg` ```shell #!/usr/bin/env sh @@ -123,7 +123,8 @@ if ! [[ "$commit_msg_header" =~ (${commit_msg_regex})|(${merge_msg_regex})|(${re exit 1 fi ``` * ⚠ make `.git-hooks/commit-msg` executable (unix: `chmod +x .git-hooks/commit-msg`) * set commit hook directory to `.git-hooks` `git config core.hooksPath '.git-hooks'` ### pre-receive Hook (server side) * create following file `.git/hooks/pre-receive` -
qoomon revised this gist
Apr 30, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -103,7 +103,7 @@ The `footer` should contain any information about **Breaking Changes** and is al ## Git Hook Scripts to ensure commit message header format ### commit-msg Hook (local) * create following file `.git-hooks/commit-msg` and make it executable (unix: `chmod +x .git-hooks/commit-msg`) ```shell #!/usr/bin/env sh
NewerOlder