Skip to content

Commit 15086ab

Browse files
committed
Deploying to gh-pages from @ 82953a8 🚀
1 parent de062dc commit 15086ab

File tree

39 files changed

+2016
-1533
lines changed

39 files changed

+2016
-1533
lines changed

commands/bump/index.html

Lines changed: 274 additions & 71 deletions
Large diffs are not rendered by default.

commands/changelog/index.html

Lines changed: 325 additions & 67 deletions
Large diffs are not rendered by default.

commands/check/index.html

Lines changed: 181 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,23 @@
601601

602602
</li>
603603

604+
</ul>
605+
</nav>
606+
607+
</li>
608+
609+
<li class="md-nav__item">
610+
<a href="#or" class="md-nav__link">
611+
<span class="md-ellipsis">
612+
613+
or
614+
615+
</span>
616+
</a>
617+
618+
<nav class="md-nav" aria-label="or">
619+
<ul class="md-nav__list">
620+
604621
<li class="md-nav__item">
605622
<a href="#-message" class="md-nav__link">
606623
<span class="md-ellipsis">
@@ -645,6 +662,34 @@
645662

646663
</li>
647664

665+
</ul>
666+
</nav>
667+
668+
</li>
669+
670+
<li class="md-nav__item">
671+
<a href="#the-following-message-passes-the-check-because-it-starts-with-merge" class="md-nav__link">
672+
<span class="md-ellipsis">
673+
674+
The following message passes the check because it starts with 'Merge'
675+
676+
</span>
677+
</a>
678+
679+
</li>
680+
681+
<li class="md-nav__item">
682+
<a href="#the-following-fails" class="md-nav__link">
683+
<span class="md-ellipsis">
684+
685+
The following fails
686+
687+
</span>
688+
</a>
689+
690+
<nav class="md-nav" aria-label="The following fails">
691+
<ul class="md-nav__list">
692+
648693
<li class="md-nav__item">
649694
<a href="#-message-length-limit" class="md-nav__link">
650695
<span class="md-ellipsis">
@@ -659,6 +704,28 @@
659704
</ul>
660705
</nav>
661706

707+
</li>
708+
709+
<li class="md-nav__item">
710+
<a href="#the-following-passes" class="md-nav__link">
711+
<span class="md-ellipsis">
712+
713+
The following passes
714+
715+
</span>
716+
</a>
717+
718+
</li>
719+
720+
<li class="md-nav__item">
721+
<a href="#the-following-fails_1" class="md-nav__link">
722+
<span class="md-ellipsis">
723+
724+
The following fails
725+
726+
</span>
727+
</a>
728+
662729
</li>
663730

664731
</ul>
@@ -2288,6 +2355,23 @@
22882355

22892356
</li>
22902357

2358+
</ul>
2359+
</nav>
2360+
2361+
</li>
2362+
2363+
<li class="md-nav__item">
2364+
<a href="#or" class="md-nav__link">
2365+
<span class="md-ellipsis">
2366+
2367+
or
2368+
2369+
</span>
2370+
</a>
2371+
2372+
<nav class="md-nav" aria-label="or">
2373+
<ul class="md-nav__list">
2374+
22912375
<li class="md-nav__item">
22922376
<a href="#-message" class="md-nav__link">
22932377
<span class="md-ellipsis">
@@ -2332,6 +2416,34 @@
23322416

23332417
</li>
23342418

2419+
</ul>
2420+
</nav>
2421+
2422+
</li>
2423+
2424+
<li class="md-nav__item">
2425+
<a href="#the-following-message-passes-the-check-because-it-starts-with-merge" class="md-nav__link">
2426+
<span class="md-ellipsis">
2427+
2428+
The following message passes the check because it starts with 'Merge'
2429+
2430+
</span>
2431+
</a>
2432+
2433+
</li>
2434+
2435+
<li class="md-nav__item">
2436+
<a href="#the-following-fails" class="md-nav__link">
2437+
<span class="md-ellipsis">
2438+
2439+
The following fails
2440+
2441+
</span>
2442+
</a>
2443+
2444+
<nav class="md-nav" aria-label="The following fails">
2445+
<ul class="md-nav__list">
2446+
23352447
<li class="md-nav__item">
23362448
<a href="#-message-length-limit" class="md-nav__link">
23372449
<span class="md-ellipsis">
@@ -2346,6 +2458,28 @@
23462458
</ul>
23472459
</nav>
23482460

2461+
</li>
2462+
2463+
<li class="md-nav__item">
2464+
<a href="#the-following-passes" class="md-nav__link">
2465+
<span class="md-ellipsis">
2466+
2467+
The following passes
2468+
2469+
</span>
2470+
</a>
2471+
2472+
</li>
2473+
2474+
<li class="md-nav__item">
2475+
<a href="#the-following-fails_1" class="md-nav__link">
2476+
<span class="md-ellipsis">
2477+
2478+
The following fails
2479+
2480+
</span>
2481+
</a>
2482+
23492483
</li>
23502484

23512485
</ul>
@@ -2365,8 +2499,6 @@
23652499

23662500

23672501

2368-
<h1>check</h1>
2369-
23702502
<p>This feature checks whether a string or a range of git commits follows the given committing rules. Comments in git messages will be ignored.</p>
23712503
<p>To set up an automatic check before every git commit, please refer to <a href="../../tutorials/auto_check/">Automatically check message before commit</a>.</p>
23722504
<h2 id="usage">Usage<a class="headerlink" href="#usage" title="Permanent link">&para;</a></h2>
@@ -2379,41 +2511,41 @@ <h2 id="usage">Usage<a class="headerlink" href="#usage" title="Permanent link">&
23792511
</ul>
23802512
<h3 id="use-cz-check-to-validate-a-commit-message-before-committing">Use <code>cz check</code> to validate a commit message before committing<a class="headerlink" href="#use-cz-check-to-validate-a-commit-message-before-committing" title="Permanent link">&para;</a></h3>
23812513
<h4 id="option-1-use-message-to-check-a-given-string">Option 1: use <code>--message</code> to check a given string:<a class="headerlink" href="#option-1-use-message-to-check-a-given-string" title="Permanent link">&para;</a></h4>
2382-
<div class="highlight"><pre><span></span><code>cz<span class="w"> </span>check<span class="w"> </span>--message<span class="w"> </span>&lt;message_to_be_checked&gt;
2383-
</code></pre></div>
2514+
<p><code>bash
2515+
cz check --message &lt;message_to_be_checked&gt;</code></p>
23842516
<h4 id="option-2-pipe-the-message-to-cz-check">Option 2: pipe the message to <code>cz check</code>:<a class="headerlink" href="#option-2-pipe-the-message-to-cz-check" title="Permanent link">&para;</a></h4>
2385-
<div class="highlight"><pre><span></span><code><span class="nb">echo</span><span class="w"> </span>&lt;message_to_be_checked&gt;<span class="w"> </span><span class="p">|</span><span class="w"> </span>cz<span class="w"> </span>check
2386-
</code></pre></div>
2517+
<p><code>bash
2518+
echo &lt;message_to_be_checked&gt; | cz check</code></p>
23872519
<h4 id="option-3-use-commit-msg-file-to-read-the-commit-message-from-a-file">Option 3: use <code>--commit-msg-file</code> to read the commit message from a file<a class="headerlink" href="#option-3-use-commit-msg-file-to-read-the-commit-message-from-a-file" title="Permanent link">&para;</a></h4>
2388-
<div class="highlight"><pre><span></span><code>cz<span class="w"> </span>check<span class="w"> </span>--commit-msg-file<span class="w"> </span>/path/to/file.txt
2389-
</code></pre></div>
2520+
<p><code>bash
2521+
cz check --commit-msg-file /path/to/file.txt</code></p>
23902522
<h2 id="command-line-options">Command Line Options<a class="headerlink" href="#command-line-options" title="Permanent link">&para;</a></h2>
23912523
<h3 id="-rev-range"><code>--rev-range</code><a class="headerlink" href="#-rev-range" title="Permanent link">&para;</a></h3>
23922524
<p>Test if a given range of commits in the git log passes <code>cz check</code>.</p>
2393-
<div class="highlight"><pre><span></span><code>cz<span class="w"> </span>check<span class="w"> </span>--rev-range<span class="w"> </span>REV_RANGE
2394-
</code></pre></div>
2525+
<p><code>bash
2526+
cz check --rev-range REV_RANGE</code></p>
23952527
<p>For more information on <code>REV_RANGE</code>, check the <a href="https://git-scm.com/book/en/v2/Git-Tools-Revision-Selection#_commit_ranges">git documentation</a>.</p>
23962528
<h4 id="use-cases">Use cases<a class="headerlink" href="#use-cases" title="Permanent link">&para;</a></h4>
23972529
<ol>
23982530
<li>
23992531
<p>Validate the latest 3 commit messages:
2400-
<div class="highlight"><pre><span></span><code>cz<span class="w"> </span>check<span class="w"> </span>--rev-range<span class="w"> </span>HEAD~3..HEAD
2401-
<span class="c1"># or</span>
2402-
cz<span class="w"> </span>check<span class="w"> </span>--rev-range<span class="w"> </span>HEAD~3..
2403-
<span class="c1"># or</span>
2404-
cz<span class="w"> </span>check<span class="w"> </span>--rev-range<span class="w"> </span>HEAD~~~..
2405-
</code></pre></div></p>
2532+
<code>bash
2533+
cz check --rev-range HEAD~3..HEAD
2534+
# or
2535+
cz check --rev-range HEAD~3..
2536+
# or
2537+
cz check --rev-range HEAD~~~..</code></p>
24062538
</li>
24072539
<li>
24082540
<p>Validate all git commit messages on some branch up to HEAD:
2409-
<div class="highlight"><pre><span></span><code>cz<span class="w"> </span>check<span class="w"> </span>--rev-range<span class="w"> </span>&lt;branch_name&gt;..HEAD
2410-
</code></pre></div></p>
2541+
<code>bash
2542+
cz check --rev-range &lt;branch_name&gt;..HEAD</code></p>
24112543
<p>For example, to check all git commit messages on <code>main</code> branch up to HEAD:
2412-
<div class="highlight"><pre><span></span><code>cz<span class="w"> </span>check<span class="w"> </span>--rev-range<span class="w"> </span>main..HEAD
2413-
</code></pre></div></p>
2544+
<code>bash
2545+
cz check --rev-range main..HEAD</code></p>
24142546
<p>or if your project still uses <code>master</code> branch:
2415-
<div class="highlight"><pre><span></span><code>cz<span class="w"> </span>check<span class="w"> </span>--rev-range<span class="w"> </span>master..HEAD
2416-
</code></pre></div></p>
2547+
<code>bash
2548+
cz check --rev-range master..HEAD</code></p>
24172549
<div class="admonition note">
24182550
<p class="admonition-title">Default branch</p>
24192551
<p>Usually the default branch is <code>main</code> or <code>master</code>.
@@ -2423,29 +2555,30 @@ <h4 id="use-cases">Use cases<a class="headerlink" href="#use-cases" title="Perma
24232555
<li>
24242556
<p>Validate all git commit messages starting from when you first implemented commit message linting:</p>
24252557
<p><strong>(Why this is useful?)</strong> Let's say you decided to enforce commit message today. However, it is impractical to <code>git rebase</code> all your previous commits. <code>--rev-range</code> helps you skip commits before you first implemented commit message linting by using a specific commit hash.</p>
2426-
<div class="highlight"><pre><span></span><code>cz<span class="w"> </span>check<span class="w"> </span>--rev-range<span class="w"> </span>&lt;first_commit_sha&gt;..HEAD
2427-
</code></pre></div>
2558+
<p><code>bash
2559+
cz check --rev-range &lt;first_commit_sha&gt;..HEAD</code></p>
24282560
</li>
24292561
</ol>
24302562
<h3 id="-use-default-range"><code>--use-default-range</code><a class="headerlink" href="#-use-default-range" title="Permanent link">&para;</a></h3>
24312563
<p>Equivalent to <code>--rev-range &lt;default_branch&gt;..HEAD</code>.</p>
2432-
<div class="highlight"><pre><span></span><code>cz<span class="w"> </span>check<span class="w"> </span>--use-default-range
2433-
<span class="c1"># or</span>
2434-
cz<span class="w"> </span>check<span class="w"> </span>-d
2435-
</code></pre></div>
2564+
<p>```bash
2565+
cz check --use-default-range</p>
2566+
<h1 id="or">or<a class="headerlink" href="#or" title="Permanent link">&para;</a></h1>
2567+
<p>cz check -d
2568+
```</p>
24362569
<h3 id="-message"><code>--message</code><a class="headerlink" href="#-message" title="Permanent link">&para;</a></h3>
24372570
<p>Test if a given string passes <code>cz check</code>.</p>
2438-
<div class="highlight"><pre><span></span><code>cz<span class="w"> </span>check<span class="w"> </span>--message<span class="w"> </span>&lt;message_to_be_checked&gt;
2439-
</code></pre></div>
2571+
<p><code>bash
2572+
cz check --message &lt;message_to_be_checked&gt;</code></p>
24402573
<h3 id="-commit-msg-file"><code>--commit-msg-file</code><a class="headerlink" href="#-commit-msg-file" title="Permanent link">&para;</a></h3>
24412574
<p>Test if a given file contains a commit message that passes <code>cz check</code>.</p>
2442-
<div class="highlight"><pre><span></span><code>cz<span class="w"> </span>check<span class="w"> </span>--commit-msg-file<span class="w"> </span>&lt;path_to_file_containing_message_to_be_checked&gt;
2443-
</code></pre></div>
2575+
<p><code>bash
2576+
cz check --commit-msg-file &lt;path_to_file_containing_message_to_be_checked&gt;</code></p>
24442577
<p>This can be useful when cooperating with git hooks. Please check <a href="../../tutorials/auto_check/">Automatically check message before commit</a> for more detailed examples.</p>
24452578
<h3 id="-allow-abort"><code>--allow-abort</code><a class="headerlink" href="#-allow-abort" title="Permanent link">&para;</a></h3>
24462579
<p>Example:</p>
2447-
<div class="highlight"><pre><span></span><code>cz<span class="w"> </span>check<span class="w"> </span>--message<span class="w"> </span>&lt;message_to_be_checked&gt;<span class="w"> </span>--allow-abort
2448-
</code></pre></div>
2580+
<p><code>bash
2581+
cz check --message &lt;message_to_be_checked&gt; --allow-abort</code></p>
24492582
<p>Empty commit messages typically instruct Git to abort a commit, so you can pass <code>--allow-abort</code> to
24502583
permit them. Since <code>git commit</code> accepts the <code>--allow-empty-message</code> flag (primarily for wrapper scripts), you may wish to disallow such commits in CI. <code>--allow-abort</code> may be used in conjunction with any of the other options.</p>
24512584
<h3 id="-allowed-prefixes"><code>--allowed-prefixes</code><a class="headerlink" href="#-allowed-prefixes" title="Permanent link">&para;</a></h3>
@@ -2459,23 +2592,23 @@ <h3 id="-allowed-prefixes"><code>--allowed-prefixes</code><a class="headerlink"
24592592
<li><code>squash!</code></li>
24602593
<li><code>amend!</code></li>
24612594
</ul>
2462-
<div class="highlight"><pre><span></span><code>cz<span class="w"> </span>check<span class="w"> </span>--message<span class="w"> </span>&lt;message_to_be_checked&gt;<span class="w"> </span>--allowed-prefixes<span class="w"> </span><span class="s1">&#39;Merge&#39;</span><span class="w"> </span><span class="s1">&#39;Revert&#39;</span><span class="w"> </span><span class="s1">&#39;Custom Prefix&#39;</span>
2463-
</code></pre></div>
2595+
<p><code>bash
2596+
cz check --message &lt;message_to_be_checked&gt; --allowed-prefixes 'Merge' 'Revert' 'Custom Prefix'</code></p>
24642597
<p>For example,</p>
2465-
<div class="highlight"><pre><span></span><code><span class="c1"># The following message passes the check because it starts with &#39;Merge&#39;</span>
2466-
cz<span class="w"> </span>check<span class="w"> </span>--message<span class="w"> </span><span class="s2">&quot;Merge branch &#39;main&#39; into feature/new-feature&quot;</span><span class="w"> </span>--allowed-prefixes<span class="w"> </span><span class="s1">&#39;Merge&#39;</span>
2467-
2468-
<span class="c1"># The following fails</span>
2469-
cz<span class="w"> </span>check<span class="w"> </span>--message<span class="w"> </span><span class="s2">&quot;Merge branch &#39;main&#39; into feature/new-feature&quot;</span><span class="w"> </span>--allowed-prefixes<span class="w"> </span><span class="s1">&#39;aaa&#39;</span>
2470-
</code></pre></div>
2598+
<p>```bash</p>
2599+
<h1 id="the-following-message-passes-the-check-because-it-starts-with-merge">The following message passes the check because it starts with 'Merge'<a class="headerlink" href="#the-following-message-passes-the-check-because-it-starts-with-merge" title="Permanent link">&para;</a></h1>
2600+
<p>cz check --message "Merge branch 'main' into feature/new-feature" --allowed-prefixes 'Merge'</p>
2601+
<h1 id="the-following-fails">The following fails<a class="headerlink" href="#the-following-fails" title="Permanent link">&para;</a></h1>
2602+
<p>cz check --message "Merge branch 'main' into feature/new-feature" --allowed-prefixes 'aaa'
2603+
```</p>
24712604
<h3 id="-message-length-limit"><code>--message-length-limit</code><a class="headerlink" href="#-message-length-limit" title="Permanent link">&para;</a></h3>
24722605
<p>Restrict the length of <strong>the first line</strong> of the commit message.</p>
2473-
<div class="highlight"><pre><span></span><code><span class="c1"># The following passes</span>
2474-
cz<span class="w"> </span>check<span class="w"> </span>--message<span class="w"> </span><span class="s2">&quot;docs(check): fix grammar issues&quot;</span><span class="w"> </span>-l<span class="w"> </span><span class="m">80</span>
2475-
2476-
<span class="c1"># The following fails</span>
2477-
cz<span class="w"> </span>check<span class="w"> </span>--message<span class="w"> </span><span class="s2">&quot;docs:very long long long long message with many words&quot;</span><span class="w"> </span>-l<span class="w"> </span><span class="m">3</span>
2478-
</code></pre></div>
2606+
<p>```bash</p>
2607+
<h1 id="the-following-passes">The following passes<a class="headerlink" href="#the-following-passes" title="Permanent link">&para;</a></h1>
2608+
<p>cz check --message "docs(check): fix grammar issues" -l 80</p>
2609+
<h1 id="the-following-fails_1">The following fails<a class="headerlink" href="#the-following-fails_1" title="Permanent link">&para;</a></h1>
2610+
<p>cz check --message "docs:very long long long long message with many words" -l 3
2611+
```</p>
24792612
<p>By default, the limit is set to <code>0</code>, which means no limit on the length.</p>
24802613
<div class="admonition note">
24812614
<p class="admonition-title">Note</p>

0 commit comments

Comments
 (0)