You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>This command is particularly useful for automation scripts and CI/CD pipelines.</p>
2791
2791
<p>For example, you can use the output of the command <code>cz changelog --dry-run "$(cz version -p)"</code> to notify your team about a new release in Slack.</p>
<p><strong>Note</strong>: Replace <code>master</code> with the <ahref="https://github.com/commitizen-tools/commitizen/tags">latest tag</a> to avoid warnings. You can automatically update this with:
<p>For more details about commit validation, see the <ahref="https://commitizen-tools.github.io/commitizen/commands/check/">check command documentation</a>.</p>
<p>To automatically check a commit message prior to committing, you can use a <ahref="https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks">Git hook</a>. This ensures that all commit messages follow your project's commitizen format before they are accepted into the repository.</p>
2337
-
<p>When a commit message fails validation, Git will reject the commit and display an error message explaining what went wrong. You'll need to amend your commit message to follow the required format before the commit can proceed.</p>
2336
+
<p>To automatically check a commit message before committing, use a <ahref="https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks">Git hook</a>. This ensures all commit messages match your project's commitizen format before they are accepted into the repository.</p>
2337
+
<p>When a commit message fails validation, Git rejects the commit and displays an error explaining what went wrong. Update the message to the required format before trying again.</p>
<p>There are two common methods for installing the hooks:</p>
2340
-
<h3id="method-1-using-pre-commit-recommended">Method 1: Using <ahref="https://pre-commit.com/">pre-commit</a> (Recommended)<aclass="headerlink" href="#method-1-using-pre-commit-recommended" title="Permanent link">¶</a></h3>
2341
-
<p><ahref="https://pre-commit.com/">pre-commit</a> is a framework for managing and maintaining multi-language pre-commit hooks. It's the recommended approach as it handles hook installation, updates, and execution automatically.</p>
<p>If you prefer not to use pre-commit, you can manually create a Git hook. This gives you full control over the hook script but requires manual maintenance.</p>
2375
+
<p>If you prefer not to use a pre-commit framework, you can manually create a Git hook. This gives you full control over the hook script but requires manual maintenance.</p>
2366
2376
<h4id="step-1-create-the-commit-msg-hook">Step 1: Create the commit-msg hook<aclass="headerlink" href="#step-1-create-the-commit-msg-hook" title="Permanent link">¶</a></h4>
2367
2377
<p>Navigate to your project's <code>.git/hooks</code> directory and create the <code>commit-msg</code> hook file:</p>
0 commit comments