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 asked me to squash commits and make the commit message more reasonable.
Not so good way of writing a commit
The seven rules of a great git commit message
- Separate subject from body with a blank line
- Limit the subject line to 50 characters
- Capitalize the subject line
- Do not end the subject line with a period
- Use the imperative mood in the subject line
- Wrap the body at 72 characters
- Use the body to explain what and why vs. 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)
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.
Did you find this article valuable?
Support Farhaan Bukhsh by becoming a sponsor. Any amount is appreciated!