Skip to content

Git Commit Style Guide

Kehang Han edited this page Jul 28, 2017 · 6 revisions

This is a wiki for RMG developers to follow more consistent commit style within the project. People feel free to add new items to make it complete.

  • Git commit message

It usually has two parts: the first line and remaining lines. The first line always serves as commit summary, keep it short. It'll be displayed in Github with bold font. The remaining lines serves as detailed descriptions, make it as detailed as possible if necessary.

There's two line breaks between the first line and the remaining lines, a good example example from Alon is

commit f7f1fee7d05085b0dd2104a36e60ffef7788d792
Author: alongd <[email protected]>
Date:   Wed Jul 12 11:34:02 2017 -0400

Removed logging.debug message in reaction.py __setDegeneracy()
    
Due to the numerous calls to __setDegeneracy(), this debug message
appears repeatedly while debuging (or running tests with -d). In fact,
it could get printed so many times that it fills the CMD stack.

When rendered in Github, it looks nice because of good separation of title and body.

  • Rewrite git message after squash

After certain git operations such as squash, git will auto-generate messages for you. Usually that is not ideal. Rewrite concise and updated message is always recommended.