# git commit -m”Best Practices”

All of us who use some kind of revision control system have this problem especially the one who are new to the whole git commit thing . Well the question I use to have what do I write what I just did and how can it be helpful to others.

I got all those question answered when I was working on moving my patch from master branch to feature branch. [Pingou](http://blog.pingoured.fr/) asked me to squash commits and make the commit message more reasonable.

![Selection_005](https://cdn.hashnode.com/res/hashnode/image/upload/v1622182581844/RnTSjVNrp.png)

Not so good way of writing a commit

Some of the references I used was [Peter Hunter’s Blog](http://who-t.blogspot.in/2009/12/on-commit-messages.html) and [Chris Beam’s](http://chris.beams.io/posts/git-commit/) Blog. And I landed up with these seven rules .

The seven rules of a great git commit message
---------------------------------------------

1.  [Separate subject from body with a blank line](http://chris.beams.io/posts/git-commit/#separate)
2.  [Limit the subject line to 50 characters](http://chris.beams.io/posts/git-commit/#limit-50)
3.  [Capitalize the subject line](http://chris.beams.io/posts/git-commit/#capitalize)
4.  [Do not end the subject line with a period](http://chris.beams.io/posts/git-commit/#end)
5.  [Use the imperative mood in the subject line](http://chris.beams.io/posts/git-commit/#imperative)
6.  [Wrap the body at 72 characters](http://chris.beams.io/posts/git-commit/#wrap-72)
7.  [Use the body to explain _what_ and _why_ vs. _how_](http://chris.beams.io/posts/git-commit/#why-not-how)

But for all the single commits which is doing a minor change you can still use git commit -m “your message”. ( Try to keep message in imperative mood)

![Selection_006](https://cdn.hashnode.com/res/hashnode/image/upload/v1622182583571/_cZH-LZj6.png)

A better way of writing commits

For bigger changes you need an editor so you might want to use a switch -a. For more details on how you can do that in pro git. Finally I am changing my habits of those shabby commit messages. So, think twice before you commit. ![😉](https://cdn.hashnode.com/res/hashnode/image/upload/v1622182584983/v1AQNTl0P.png)
