You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
teaser: "Explore the world of Git commit naming standards and learn how to choose the right one for your project",
33
+
34
+
content: <>
35
+
<p>
36
+
Personally, I must admit that I haven't always adhered to naming conventions when making Git commits. However, I've come to realize the tremendous benefits they offer, especially when working in teams. Recently, while working on Commit Rocket, I found myself seeking a structured approach to commit naming.
37
+
</p>
38
+
<p>
39
+
That is why I am writing this article! I would like to find out what makes a great commit message and which standards there are. Also most importantly for me, which approach I could implement in Commit Rocket. I hope to take you along and teach you what I've learned.
40
+
</p>
41
+
<A.H2>Benefits of Naming Conventions</A.H2>
42
+
<p>
43
+
From my own experience, I've found that having a structured way to name commits significantly reduces the stress and uncertainty associated with creating commit messages. When you can clearly express the purpose and impact of your changes in a concise manner, it becomes easier to navigate and understand the commit history. It also helps when you need to locate a specific commit later on, whether to review the changes or revert them if needed.
44
+
</p>
45
+
<A.H3>Anatomy of a Commit Message</A.H3>
46
+
<p>
47
+
As you can see, a commit message is meant to convey some sort of meaning. Having standardized ways to write these messages means that everyone will be on the same page.
48
+
</p>
49
+
<A.H4>Imperative Mood</A.H4>
50
+
<p>
51
+
It's important to use the imperative mood, which provides a clear instruction about what the commit does. Instead of saying "I added feature XYZ," it should be "Add feature XYZ." This small change in phrasing makes a big difference in creating a consistent and actionable commit history.
52
+
</p>
53
+
<A.H4>Detail and Explanation</A.H4>
54
+
<p>
55
+
Commit messages should be detailed enough to convey the purpose and context of the changes. When writing commit messages ask yourself why the changes were made, what the context is of the changes and what effect it will have.
56
+
</p>
57
+
<p>
58
+
While a short one-liner can work in some cases, using multi-paragraph messages can provide a more in-depth explanation, especially for complex or significant changes. If you're using the Git command-line interface, you can achieve this by adding an extra `-m` flag to the commit command. Here is an example:
59
+
</p>
60
+
<A.Codelang="bash">
61
+
git commit -m "Fix bug where users could switch to light mode" -m "Users were able to switch to light mode because the settings data loaded from the LocalStorage was not validated"
62
+
</A.Code>
63
+
<A.H4>Length and Content</A.H4>
64
+
<p>
65
+
The length of a commit message is also important. Aim for around 50 to 75 characters to keep it concise and readable. Avoid using filler words or unnecessary details like "I think" or "maybe." Instead, focus on conveying the essence of the change in a clear and straightforward manner.
66
+
</p>
67
+
<A.H2>Popular Naming Conventions</A.H2>
68
+
<p>
69
+
There are several widely adopted naming conventions that can serve as helpful guidelines for crafting effective commit messages. Here are two popular options:
Gitmoji introduces emojis to commit messages, giving them a visually appealing touch. It follows a format that includes an intention, an optional scope, and a message. For example:
101
+
</p>
102
+
</div>
103
+
<A.Codelang="bash">
104
+
🐛 Fix issue with form validation
105
+
</A.Code>
106
+
<p>
107
+
While Gitmoji brings a fun and expressive aspect to commit messages, it may take some time to get used to its unique set of emojis and their meanings.
108
+
</p>
109
+
<A.H2>Conclusion</A.H2>
110
+
<divclassName="flex items-center gap-4">
111
+
<p>
112
+
The Commit Rocket repository will likely be making use of Gitmoji. It will take some getting used to for people, but I think it is a neat and clean way to express code changes. I also think that adding a visual aspect to commits is a fun idea. Maybe adding template commit names to Commit Rocket will be helpful 🤔.
113
+
</p>
114
+
<img
115
+
className="w-24 h-24 aspect-square rotate-30"
116
+
{...logo}
117
+
/>
118
+
</div>
119
+
<p>
120
+
Remember, commit naming conventions are just tools to help us communicate effectively and collaborate smoothly within our projects. While there are various conventions to choose from, the most important thing is to adopt one that works well for you and your team.
0 commit comments