DEV Community

Jayesh Tembhekar ⚡
Jayesh Tembhekar ⚡

Posted on

Git commit message 💬

Hello, there 👋🏼 I hope you are doing well.

As a developer, I know you are well aware of the Git version control system.

Just wanted to know:

How do you write your

git commit -m "commit message"

Do you follow any special rule or something?
Let's discuss in the comment section below 😄

Oldest comments (19)

Collapse
 
amplanetwork profile image
Ampla Network

Describe what I will push... What to say... 😄

Collapse
 
angelmtztrc profile image
Angel Martinez

I recently started using emojis in my commits, they really look good, this is an example:

✨feature(scope): a short description of the feature

But, I really want to see other good ideas for commits

Collapse
 
mindset profile image
Jayesh Tembhekar ⚡

I also ❤ emojis

Collapse
 
contourintegral profile image

My format is:
git commit -m "$SUPPORTING_EMOJI:$TYPE_OF_COMMIT: $COMMIT_DESCRIPTION"

Collapse
 
akhterali profile image
Mo Ali

[PROJECT-TICKET] Tasks completed in present tense

Collapse
 
shadowtime2000 profile image
shadowtime2000

I either use the conventional commits specification or just type what describes the commit best.

Collapse
 
mindset profile image
Jayesh Tembhekar ⚡

This is nice 👌🏻

Collapse
 
vuong profile image
Vuong

I have a template for Git commit in work which mentions the pattern of issue ID then it can be checking crossly with issues management tool by just a click, but just use the simple message for my personal stuffs.

Collapse
 
aftabksyed profile image
Aftab Syed

What template are you talking about and how do you implement/incorporate that template when committing the code?

Collapse
 
vuong profile image
Vuong

thoughtbot.com/blog/better-commit-... here is a tutorial. My template is just put the prefix string like ABC-, then whenever I commit code, I just put the number sequentially defined prefix and also commit message at the end.

Git commit template is also affected to Git-familiar-tools like VScode/Fork.

Collapse
 
curtisl profile image
Curtis Lawrence

A while back I adopted this format for an angular project, which is basically the Angular commit format It became muscle memory and has essentially become my standard.

<type>(<scope>): <subject>
<BLANK LINE>
<description>
Enter fullscreen mode Exit fullscreen mode
Collapse
 
melezhik profile image
Alexey Melezhik • Edited

a couple of things:

The whole flow is available through the Tomtit task runner - github.com/melezhik/Tomtit#profiles

 tom --profile git
 tom commit
 tom push
Enter fullscreen mode Exit fullscreen mode

Or

 tom git-publish
Enter fullscreen mode Exit fullscreen mode
Collapse
 
codefinity profile image
Manav Misra

Start with a verb in the imperative/present tense. Follow with a short sentence describing the task that just occurred - no period at end.
Might also use Gitmoji

Collapse
 
jcubic profile image
Jakub T. Jankiewicz

There are rules how to write them correctly by design of git, they are probably invented by Linus Torvalds author of git.
The message should look like this:

short sentence that describe the change

Detail description why the change was needed. You don't need to write
what was changed since that is inside the commit itself. But rationale
is important, so you can benefit why the change happen.
Enter fullscreen mode Exit fullscreen mode

also the first sentence should be shorter (not sure exactly how many characters).

I'm trying to write commit message like this if there are reason why something was changed. This is important specially with big projects and lot of changes where you don't know other part of the code. The message should be the clue.