Skip to content

Commit 09b2d9a

Browse files
committed
Deploying to gh-pages from @ 7d1bcc8 🚀
1 parent 0b02379 commit 09b2d9a

File tree

3 files changed

+47
-36
lines changed

3 files changed

+47
-36
lines changed

index.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -507,10 +507,10 @@
507507
</li>
508508

509509
<li class="md-nav__item">
510-
<a href="#pre-commit-integration" class="md-nav__link">
510+
<a href="#prek-and-pre-commit-integration" class="md-nav__link">
511511
<span class="md-ellipsis">
512512

513-
Pre-commit Integration
513+
Prek and Pre-commit Integration
514514

515515
</span>
516516
</a>
@@ -2457,10 +2457,10 @@
24572457
</li>
24582458

24592459
<li class="md-nav__item">
2460-
<a href="#pre-commit-integration" class="md-nav__link">
2460+
<a href="#prek-and-pre-commit-integration" class="md-nav__link">
24612461
<span class="md-ellipsis">
24622462

2463-
Pre-commit Integration
2463+
Prek and Pre-commit Integration
24642464

24652465
</span>
24662466
</a>
@@ -2666,7 +2666,7 @@ <h1>Introduction</h1>
26662666
<a href="https://anaconda.org/conda-forge/commitizen"><img alt="Conda Version" src="https://img.shields.io/conda/vn/conda-forge/commitizen?style=flat-square" /></a>
26672667
<a href="https://formulae.brew.sh/formula/commitizen"><img alt="homebrew" src="https://img.shields.io/homebrew/v/commitizen?color=teal&amp;style=flat-square" /></a>
26682668
<a href="https://codecov.io/gh/commitizen-tools/commitizen"><img alt="Codecov" src="https://img.shields.io/codecov/c/github/commitizen-tools/commitizen.svg?style=flat-square" /></a>
2669-
<a href="https://github.com/pre-commit/pre-commit"><img alt="pre-commit" src="https://img.shields.io/badge/pre--commit-enabled-brightgreen?style=flat-square&amp;logo=pre-commit&amp;logoColor=white" /></a></p>
2669+
<a href="https://github.com/j178/prek"><img alt="prek" src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/j178/prek/master/docs/assets/badge-v0.json&amp;style=flat-square&amp;color=brightgreen" /></a></p>
26702670
<p><img alt="Using Commitizen cli" src="images/demo.gif" /></p>
26712671
<hr />
26722672
<p><a href="https://commitizen-tools.github.io/commitizen/"><strong>Commitizen Documentation Site</strong></a></p>
@@ -2789,7 +2789,7 @@ <h4 id="get-project-version">Get Project Version<a class="headerlink" href="#get
27892789
</code></pre></div>
27902790
<p>This command is particularly useful for automation scripts and CI/CD pipelines.</p>
27912791
<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>
2792-
<h4 id="pre-commit-integration">Pre-commit Integration<a class="headerlink" href="#pre-commit-integration" title="Permanent link">&para;</a></h4>
2792+
<h4 id="prek-and-pre-commit-integration">Prek and Pre-commit Integration<a class="headerlink" href="#prek-and-pre-commit-integration" title="Permanent link">&para;</a></h4>
27932793
<p>Commitizen can automatically validate your commit messages using pre-commit hooks.</p>
27942794
<ol>
27952795
<li>
@@ -2806,7 +2806,7 @@ <h4 id="pre-commit-integration">Pre-commit Integration<a class="headerlink" href
28062806
</li>
28072807
<li>
28082808
<p>Install the hooks:
2809-
<div class="highlight"><pre><span></span><code>pre-commit<span class="w"> </span>install<span class="w"> </span>--hook-type<span class="w"> </span>commit-msg<span class="w"> </span>--hook-type<span class="w"> </span>pre-push
2809+
<div class="highlight"><pre><span></span><code>prek<span class="w"> </span>install<span class="w"> </span>--hook-type<span class="w"> </span>commit-msg<span class="w"> </span>--hook-type<span class="w"> </span>pre-push
28102810
</code></pre></div></p>
28112811
</li>
28122812
</ol>
@@ -2830,7 +2830,7 @@ <h4 id="pre-commit-integration">Pre-commit Integration<a class="headerlink" href
28302830
</table>
28312831
<blockquote>
28322832
<p><strong>Note</strong>: Replace <code>master</code> with the <a href="https://github.com/commitizen-tools/commitizen/tags">latest tag</a> to avoid warnings. You can automatically update this with:
2833-
<div class="highlight"><pre><span></span><code>pre-commit<span class="w"> </span>autoupdate
2833+
<div class="highlight"><pre><span></span><code>prek<span class="w"> </span>autoupdate
28342834
</code></pre></div></p>
28352835
</blockquote>
28362836
<p>For more details about commit validation, see the <a href="https://commitizen-tools.github.io/commitizen/commands/check/">check command documentation</a>.</p>

search/search_index.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

tutorials/auto_check/index.html

Lines changed: 38 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,22 +1205,22 @@
12051205
<ul class="md-nav__list">
12061206

12071207
<li class="md-nav__item">
1208-
<a href="#method-1-using-pre-commit-recommended" class="md-nav__link">
1208+
<a href="#method-1-using-pre-commit-hook-frameworks-recommended" class="md-nav__link">
12091209
<span class="md-ellipsis">
12101210

1211-
Method 1: Using pre-commit (Recommended)
1211+
Method 1: Using pre-commit hook frameworks (Recommended)
12121212

12131213
</span>
12141214
</a>
12151215

1216-
<nav class="md-nav" aria-label="Method 1: Using pre-commit (Recommended)">
1216+
<nav class="md-nav" aria-label="Method 1: Using pre-commit hook frameworks (Recommended)">
12171217
<ul class="md-nav__list">
12181218

12191219
<li class="md-nav__item">
1220-
<a href="#step-1-install-pre-commit" class="md-nav__link">
1220+
<a href="#step-1-install-prek" class="md-nav__link">
12211221
<span class="md-ellipsis">
12221222

1223-
Step 1: Install pre-commit
1223+
Step 1: Install prek
12241224

12251225
</span>
12261226
</a>
@@ -1344,10 +1344,10 @@
13441344
</li>
13451345

13461346
<li class="md-nav__item">
1347-
<a href="#pre-commit-hook-not-working" class="md-nav__link">
1347+
<a href="#prek-hook-not-working" class="md-nav__link">
13481348
<span class="md-ellipsis">
13491349

1350-
Pre-commit hook not working
1350+
Prek hook not working
13511351

13521352
</span>
13531353
</a>
@@ -2138,22 +2138,22 @@
21382138
<ul class="md-nav__list">
21392139

21402140
<li class="md-nav__item">
2141-
<a href="#method-1-using-pre-commit-recommended" class="md-nav__link">
2141+
<a href="#method-1-using-pre-commit-hook-frameworks-recommended" class="md-nav__link">
21422142
<span class="md-ellipsis">
21432143

2144-
Method 1: Using pre-commit (Recommended)
2144+
Method 1: Using pre-commit hook frameworks (Recommended)
21452145

21462146
</span>
21472147
</a>
21482148

2149-
<nav class="md-nav" aria-label="Method 1: Using pre-commit (Recommended)">
2149+
<nav class="md-nav" aria-label="Method 1: Using pre-commit hook frameworks (Recommended)">
21502150
<ul class="md-nav__list">
21512151

21522152
<li class="md-nav__item">
2153-
<a href="#step-1-install-pre-commit" class="md-nav__link">
2153+
<a href="#step-1-install-prek" class="md-nav__link">
21542154
<span class="md-ellipsis">
21552155

2156-
Step 1: Install pre-commit
2156+
Step 1: Install prek
21572157

21582158
</span>
21592159
</a>
@@ -2277,10 +2277,10 @@
22772277
</li>
22782278

22792279
<li class="md-nav__item">
2280-
<a href="#pre-commit-hook-not-working" class="md-nav__link">
2280+
<a href="#prek-hook-not-working" class="md-nav__link">
22812281
<span class="md-ellipsis">
22822282

2283-
Pre-commit hook not working
2283+
Prek hook not working
22842284

22852285
</span>
22862286
</a>
@@ -2333,14 +2333,24 @@
23332333

23342334
<h1 id="automatically-check-message-before-commit">Automatically check message before commit<a class="headerlink" href="#automatically-check-message-before-commit" title="Permanent link">&para;</a></h1>
23352335
<h2 id="about">About<a class="headerlink" href="#about" title="Permanent link">&para;</a></h2>
2336-
<p>To automatically check a commit message prior to committing, you can use a <a href="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 <a href="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>
23382338
<h2 id="how-to">How to<a class="headerlink" href="#how-to" title="Permanent link">&para;</a></h2>
23392339
<p>There are two common methods for installing the hooks:</p>
2340-
<h3 id="method-1-using-pre-commit-recommended">Method 1: Using <a href="https://pre-commit.com/">pre-commit</a> (Recommended)<a class="headerlink" href="#method-1-using-pre-commit-recommended" title="Permanent link">&para;</a></h3>
2341-
<p><a href="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>
2342-
<h4 id="step-1-install-pre-commit">Step 1: Install pre-commit<a class="headerlink" href="#step-1-install-pre-commit" title="Permanent link">&para;</a></h4>
2343-
<div class="highlight"><pre><span></span><code>python<span class="w"> </span>-m<span class="w"> </span>pip<span class="w"> </span>install<span class="w"> </span>pre-commit
2340+
<h3 id="method-1-using-pre-commit-hook-frameworks-recommended">Method 1: Using pre-commit hook frameworks (Recommended)<a class="headerlink" href="#method-1-using-pre-commit-hook-frameworks-recommended" title="Permanent link">&para;</a></h3>
2341+
<p>Using pre-commit hook frameworks is the recommended approach because hook installation, updates, and execution are handled automatically.
2342+
Two common frameworks are:</p>
2343+
<ol>
2344+
<li><a href="https://prek.j178.dev">prek</a> (faster)</li>
2345+
<li><a href="https://pre-commit.com/">pre-commit</a></li>
2346+
</ol>
2347+
<p>In the steps below, we'll use <code>prek</code>.</p>
2348+
<div class="admonition tip">
2349+
<p class="admonition-title">Using pre-commit framework</p>
2350+
<p>If you use pre-commit instead of prek, you can run the same commands. Simply replace prek with pre-commit in the steps below.</p>
2351+
</div>
2352+
<h4 id="step-1-install-prek">Step 1: Install prek<a class="headerlink" href="#step-1-install-prek" title="Permanent link">&para;</a></h4>
2353+
<div class="highlight"><pre><span></span><code>python<span class="w"> </span>-m<span class="w"> </span>pip<span class="w"> </span>install<span class="w"> </span>prek
23442354
</code></pre></div>
23452355
<h4 id="step-2-create-pre-commit-configyaml">Step 2: Create <code>.pre-commit-config.yaml</code><a class="headerlink" href="#step-2-create-pre-commit-configyaml" title="Permanent link">&para;</a></h4>
23462356
<p>Create a <code>.pre-commit-config.yaml</code> file in your project root directory with the following content:</p>
@@ -2358,11 +2368,11 @@ <h4 id="step-2-create-pre-commit-configyaml">Step 2: Create <code>.pre-commit-co
23582368
</div>
23592369
<h4 id="step-3-install-the-hook">Step 3: Install the hook<a class="headerlink" href="#step-3-install-the-hook" title="Permanent link">&para;</a></h4>
23602370
<p>Install the configuration into Git's hook system:</p>
2361-
<div class="highlight"><pre><span></span><code>pre-commit<span class="w"> </span>install<span class="w"> </span>--hook-type<span class="w"> </span>commit-msg
2371+
<div class="highlight"><pre><span></span><code>prek<span class="w"> </span>install<span class="w"> </span>--hook-type<span class="w"> </span>commit-msg
23622372
</code></pre></div>
23632373
<p>The hook is now active! Every time you create a commit, commitizen will automatically validate your commit message.</p>
23642374
<h3 id="method-2-manual-git-hook-installation">Method 2: Manual Git hook installation<a class="headerlink" href="#method-2-manual-git-hook-installation" title="Permanent link">&para;</a></h3>
2365-
<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>
23662376
<h4 id="step-1-create-the-commit-msg-hook">Step 1: Create the commit-msg hook<a class="headerlink" href="#step-1-create-the-commit-msg-hook" title="Permanent link">&para;</a></h4>
23672377
<p>Navigate to your project's <code>.git/hooks</code> directory and create the <code>commit-msg</code> hook file:</p>
23682378
<div class="highlight"><pre><span></span><code><span class="nb">cd</span><span class="w"> </span>.git/hooks
@@ -2389,7 +2399,7 @@ <h2 id="testing-the-hook">Testing the hook<a class="headerlink" href="#testing-t
23892399
<span class="c1"># This should succeed with a valid message</span>
23902400
git<span class="w"> </span>commit<span class="w"> </span>-m<span class="w"> </span><span class="s2">&quot;feat: add new feature&quot;</span>
23912401
</code></pre></div>
2392-
<p>If the hook is working correctly, invalid commit messages will be rejected with an error message explaining what's wrong.</p>
2402+
<p>If the hook is working correctly, invalid commit messages are rejected with an error explaining what's wrong.</p>
23932403
<h2 id="what-happens-when-validation-fails">What happens when validation fails?<a class="headerlink" href="#what-happens-when-validation-fails" title="Permanent link">&para;</a></h2>
23942404
<p>When a commit message fails validation:</p>
23952405
<ol>
@@ -2416,12 +2426,12 @@ <h3 id="hook-not-running">Hook not running<a class="headerlink" href="#hook-not-
24162426
<li><strong>Verify commitizen is installed</strong>: Run <code>cz --version</code> to confirm commitizen is available in your PATH</li>
24172427
<li><strong>Check Git version</strong>: Ensure you're using a recent version of Git that supports hooks</li>
24182428
</ul>
2419-
<h3 id="pre-commit-hook-not-working">Pre-commit hook not working<a class="headerlink" href="#pre-commit-hook-not-working" title="Permanent link">&para;</a></h3>
2429+
<h3 id="prek-hook-not-working">Prek hook not working<a class="headerlink" href="#prek-hook-not-working" title="Permanent link">&para;</a></h3>
24202430
<ul>
2421-
<li><strong>Verify installation</strong>: Run <code>pre-commit --version</code> to confirm pre-commit is installed</li>
2422-
<li><strong>Reinstall the hook</strong>: Try running <code>pre-commit install --hook-type commit-msg</code> again</li>
2431+
<li><strong>Verify installation</strong>: Run <code>prek --version</code> to confirm pre-commit is installed</li>
2432+
<li><strong>Reinstall the hook</strong>: Try running <code>prek install --hook-type commit-msg</code> again</li>
24232433
<li><strong>Check configuration</strong>: Verify your <code>.pre-commit-config.yaml</code> file is valid YAML and in the project root</li>
2424-
<li><strong>Update hooks</strong>: Run <code>pre-commit autoupdate</code> to update to the latest versions</li>
2434+
<li><strong>Update hooks</strong>: Run <code>prek autoupdate</code> to update to the latest versions</li>
24252435
</ul>
24262436
<h3 id="bypassing-the-hook-when-needed">Bypassing the hook (when needed)<a class="headerlink" href="#bypassing-the-hook-when-needed" title="Permanent link">&para;</a></h3>
24272437
<p>If you need to bypass the hook temporarily (e.g., for merge commits or special cases), you can use:</p>
@@ -2435,6 +2445,7 @@ <h2 id="additional-resources">Additional resources<a class="headerlink" href="#a
24352445
<ul>
24362446
<li>Learn more about <a href="https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks">Git hooks</a></li>
24372447
<li>See the <a href="../../commands/check/">check command documentation</a> for more validation options</li>
2448+
<li>Check out <a href="https://prek.j178.dev/">prek documentation</a> for advanced hook management</li>
24382449
<li>Check out <a href="https://pre-commit.com/">pre-commit documentation</a> for advanced hook management</li>
24392450
</ul>
24402451

0 commit comments

Comments
 (0)