Skip to content

Commit 1ce417a

Browse files
committed
Place commit style guide properly
This project expects contributors to these additional rules. Change-Id: I3d9411e792be96cd76873a70786f7d07cd89dc4c
1 parent 6f5a552 commit 1ce417a

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

CONTRIBUTING.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,34 @@ mainstream architectures. PDP-11 era is long gone.
789789
- It is fair to assume that `NULL` is matching `(uintptr_t) 0` and it is fair
790790
to `memset()` structures with zero. Non-zero `NULL` is for retro computing.
791791
792+
## Commit Style
793+
794+
Simple housekeeping for a clean git history. Read more on
795+
[How to Write a Git Commit Message](https://cbea.ms/git-commit/).
796+
1. Separate the subject from the body with a blank line.
797+
2. Limit the subject line to 50 characters.
798+
3. Capitalize the subject line.
799+
4. Do not end the subject line with a period.
800+
5. Use the imperative mood in the subject line.
801+
6. Wrap the body at 72 characters.
802+
7. Use the body to explain what and why, not how.
803+
804+
In addition, this project expects contributors to follow these additional rules:
805+
* If there is important, useful, or essential conversation or information,
806+
include a reference or copy it.
807+
* Do not write single-word commits. Provide a descriptive subject.
808+
* Avoid using just a filename (e.g., `Update qtest.c`).
809+
Each commit message subject should be sufficiently descriptive.
810+
* Avoid using abusive words.
811+
* For queue functions (names starting with "q_", e.g., `Implement q_size` or `Finish q_new`),
812+
ensure the commit message includes a detailed explanation in the body.
813+
* Avoid using backticks in commit subjects.
814+
Backticks can be easily confused with single quotes on some terminals,
815+
reducing readability. Plain text or single quotes provide sufficient clarity and emphasis.
816+
* Avoid using parentheses in commit subjects.
817+
Excessive use of parentheses "()" can clutter the subject line,
818+
making it harder to quickly grasp the essential message.
819+
792820
## References
793821
- [Linux kernel coding style](https://www.kernel.org/doc/html/latest/process/coding-style.html)
794822
- 1999, Brian W. Kernighan and Rob Pike, The Practice of Programming, Addison–Wesley.

scripts/commit-msg.hook

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ display_warnings() {
9393

9494
echo
9595
echo -e "${RED}$(cat <<-EOF
96-
How to Write a Git Commit Message: https://chris.beams.io/posts/git-commit/
96+
Read https://github.com/sysprog21/lab0-c/blob/master/CONTRIBUTING.md#commit-style carefully.
9797
EOF
9898
)${NC}"
9999
}

0 commit comments

Comments
 (0)