Skip to content

Commit 7b987fa

Browse files
authored
Create Git Commit Message Format.md
1 parent 9e9ce3e commit 7b987fa

File tree

1 file changed

+121
-0
lines changed

1 file changed

+121
-0
lines changed

Git Commit Message Format.md

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# Standard Git Commit Message Format
2+
3+
A **standard Git commit message format** helps maintain clarity and consistency in a project. A widely used convention is the **Conventional Commits** format.
4+
5+
## **1. Standard Git Commit Format**
6+
7+
```plaintext
8+
<type>(<scope>): <short description>
9+
10+
[Optional] <Detailed explanation of the changes>
11+
12+
[Optional] Closes #<issue-number> or References #<issue-number>
13+
```
14+
15+
---
16+
17+
## **2. Commit Message Types (Standard Keywords)**
18+
19+
| Type | Description |
20+
| ------------ | ------------------------------------------------------------ |
21+
| **feat** | A new feature |
22+
| **fix** | A bug fix |
23+
| **chore** | Maintenance tasks (e.g., refactoring, updates) |
24+
| **docs** | Documentation changes |
25+
| **style** | Formatting changes (whitespace, linting, missing semicolons) |
26+
| **refactor** | Code restructuring without changing behavior |
27+
| **perf** | Performance improvements |
28+
| **test** | Adding or updating tests |
29+
| **ci** | Changes to CI/CD configurations |
30+
| **build** | Changes to the build system or dependencies |
31+
32+
---
33+
34+
## **3. Commit Scope (Optional)**
35+
36+
The **scope** specifies the part of the project affected by the change, like:
37+
38+
- `auth`
39+
- `models`
40+
- `views`
41+
- `database`
42+
- `api`
43+
- `ui`
44+
- `tests`
45+
46+
---
47+
48+
## **4. Example Commit Messages**
49+
50+
### **Good Examples**
51+
52+
```sh
53+
git commit -m "feat(auth): add phone number login for students"
54+
```
55+
56+
```sh
57+
git commit -m "fix(database): resolve UUID validation error"
58+
```
59+
60+
```sh
61+
git commit -m "docs(readme): update setup instructions"
62+
```
63+
64+
```sh
65+
git commit -m "refactor(api): optimize image watermarking function"
66+
```
67+
68+
```sh
69+
git commit -m "chore(deps): update Django to 5.1"
70+
```
71+
72+
```sh
73+
git commit -m "test(auth): add unit tests for phone login"
74+
```
75+
76+
```sh
77+
git commit -m "ci(github-actions): add automated testing workflow"
78+
```
79+
80+
---
81+
82+
## **5. Commit Messages for Multiple Changes**
83+
84+
If you have multiple related changes, you can provide a **detailed explanation**:
85+
86+
```plaintext
87+
feat(users): add UUID-based authentication
88+
89+
- Replaced integer IDs with UUIDs for better security.
90+
- Updated user model, serializers, and views accordingly.
91+
- Updated database migration to support UUID primary keys.
92+
93+
Closes #42
94+
```
95+
96+
Commit with:
97+
98+
```sh
99+
git commit -m "feat(users): add UUID-based authentication" -m "- Replaced integer IDs with UUIDs for better security. - Updated user model, serializers, and views accordingly. - Updated database migration to support UUID primary keys."
100+
```
101+
102+
---
103+
104+
## **6. Push the Commit**
105+
106+
After committing, push your changes:
107+
108+
```sh
109+
git push origin main
110+
```
111+
112+
or if you're on another branch:
113+
114+
```sh
115+
git push origin <branch-name>
116+
```
117+
118+
---
119+
120+
This format keeps your commit history clean, readable, and easy to track. 🚀
121+

0 commit comments

Comments
 (0)