Skip to content

Git Commit Guidelines

Arjun edited this page Jan 27, 2018 · 2 revisions

Good commit messages serve at least these below important purposes:

  • To speed up the reviewing process.

  • To help us write a good release note.

DO

  • Write the summary line and description of what you have done in the imperative mode, that is as if you were commanding someone. Start the line with "Fix", "Add", "Change" instead of "Fixed", "Added", "Changed".
  • Always leave the second line blank.
  • Line break the commit message (to make the commit message readable without having to scroll horizontally in gitk).

DON'T

  • Don't end the summary line with a period - it's a title and titles don't end with a period.

Tips

  • If it seems difficult to summarize what your commit does, it may be because it includes several logical changes or bug fixes, and are better split up into several commits using git add -p.

References

The following blog post has a nice discussion of commit messages:

"On commit messages":http://who-t.blogspot.com/2009/12/on-commit-messages.html

"How To Write A Proper Git Commit Message":https://medium.com/@steveamaza/how-to-write-a-proper-git-commit-message-e028865e5791