Skip to content

Commit bfa7b11

Browse files
authored
Merge pull request #42 from rockstaedt/33-update-readme-with-usage-example
Update README with usage example
2 parents b41ea1d + e6eae61 commit bfa7b11

File tree

3 files changed

+54
-12
lines changed

3 files changed

+54
-12
lines changed

README.md

Lines changed: 54 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
# Commit Message Checker
1+
# Commit Message Check
22

33
[![build](https://github.com/rockstaedt/commit-message-check/actions/workflows/CI.yml/badge.svg)](https://github.com/rockstaedt/commit-message-check/actions/workflows/CI.yml)
44
[![codecov](https://codecov.io/gh/rockstaedt/commit-message-check/branch/main/graph/badge.svg?token=VW245SMVP5)](https://codecov.io/gh/rockstaedt/commit-message-check)
55
[![Latest tag](https://img.shields.io/github/v/tag/rockstaedt/commit-message-check)](https://github.com/rockstaedt/commit-message-check/releases)
66

7-
**Attention: Still under development!**
8-
9-
This is a commit message git hook to ensure that commit messages are not too
10-
long.
7+
Commit-message-check is a CLI tool that you can use in your terminal to ensure that your commit messages aren't too
8+
long. It is easily setup and can be used for any git project.
119

1210
## Installation
1311

@@ -21,14 +19,58 @@ further [reference](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks).
2119
curl -o install.sh -L https://rg.gosu.cc/rockstaedt/commit-message-check/main/install.sh && chmod +x ./install.sh && ./install.sh
2220
```
2321

24-
## Usage (Deprecated)
22+
## Usage
23+
24+
Everything is setup during the installation process. No further configuration is needed.
25+
26+
The tool is executed every time a commit is made. A commit message with more than 50 and less than 72 characters in the
27+
subject line produces a warning. The exceeding characters are highlighted. See the following example:
28+
29+
![warning.png](docs%2Fwarning.png)
30+
31+
If the commit message is longer than 72 characters, the user will be asked if the commit should be aborted.
32+
33+
![abort.png](docs%2Fabort.png)
34+
35+
## Warning
36+
37+
The tool is not suitable for making commits from within an IDE. The commit will fail, showing an error message
38+
indicating that the TTY device is not configured. I spent a lot of time researching if there is a possibility to cover
39+
both use cases. Apparently, there is no way to distinguish between a commit made from within a terminal or an IDE.
40+
If you have any ideas, please let me know! :)
41+
42+
As for now, I recommend to use the tool only for commits made from within a terminal. If you want to make a commit
43+
from within an IDE, you can temporarily disable the hook by executing the following command:
44+
45+
```shell
46+
./commit-message-check uninstall
47+
```
48+
49+
This removes the git hook, and you can make a commit from within your IDE. If you want to enable the hook again,
50+
simply execute the following command:
51+
52+
```shell
53+
./commit-message-check setup
54+
```
55+
56+
## Updates
2557

26-
Every time a git commit is made, the corresponding hook is fired. For a commit
27-
message that is too long (>50 characters), the commit process is
28-
aborted and a warning is shown. See the following as an example.
58+
You can easily update the tool by executing the following command:
2959

3060
```shell
31-
$ git commit -m "Veryyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy long"
32-
2022/12/18 12:34:43 [INFO] Validating commit message...
33-
2022/12/18 12:34:43 [ERROR] Abort commit. Subject line too long. Please fix.
61+
./commit-message-check update
3462
```
63+
64+
This will check the repository for a new release and download the latest binary.
65+
66+
## Contributions
67+
68+
Contributions are welcome! Please feel free to open an issue or a pull request. Also, if you have any ideas for
69+
improvements, please do not hesitate to contact me. If you like the tool, please give it a star. :)
70+
71+
## Background
72+
73+
The idea to make this tool initiated in a pairing session with [mschirmer](https://github.com/mschirmer1301). Using
74+
Code With Me from Jetbrains, we found ourselves using git a lot from within the terminal because
75+
the commit tool window is only visible for the host. We wanted to have a simple way to ensure that our commit messages
76+
are not too long as we were used to by the highlighting from within the IDE. This is how commit-message-check was born.

docs/abort.png

16.9 KB
Loading

docs/warning.png

22.1 KB
Loading

0 commit comments

Comments
 (0)