Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit dc0c86f

Browse files
committed
docs(tutorials): add tutorial for automatically preparing commit message
1 parent a2d0cb8 commit dc0c86f

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Automatically prepare message before commit
2+
3+
## About
4+
5+
To automatically prepare a commit message prior to committing, you can use a [Git hook](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks).
6+
7+
## How to
8+
9+
- Step 1: Create a new [`prepare-commit-msg`][prepare-commit-msg-docs] Git hook by running the following commands from the root of the Git repository:
10+
11+
```sh
12+
cd .git/hooks
13+
touch prepare-commit-msg
14+
chmod +x prepare-commit-msg
15+
```
16+
17+
- Step 2: Edit the newly created file and add the following content:
18+
19+
```sh
20+
#!/bin/sh
21+
COMMIT_MSG_FILE=1ドル
22+
exec < /dev/tty && cz commit --dry-run --write-message-to-file $COMMIT_MSG_FILE || true
23+
```
24+
25+
See the Git hooks documentation on [`prepare-commit-msg` hooks][prepare-commit-msg-docs] for details on how this works.
26+
27+
[prepare-commit-msg-docs]: https://git-scm.com/docs/githooks#_prepare_commit_msg

‎mkdocs.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ nav:
4343
- Tutorials:
4444
- Writing commits: "tutorials/writing_commits.md"
4545
- Auto check commits: "tutorials/auto_check.md"
46+
- Auto prepare commit message: "tutorials/auto_prepare_commit_message.md"
4647
- GitLab CI: "tutorials/gitlab_ci.md"
4748
- Github Actions: "tutorials/github_actions.md"
4849
- Jenkins pipeline: "tutorials/jenkins_pipeline.md"

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /