Guidelines for Commit Messages
Those are only recommended guidelines and maintainers can feel free to adopt other guidelines.
A more extensive documentation in line with the GNOME commit style including reasoning is available at http://coala.readthedocs.org/en/latest/Getting_Involved/Writing_Good_Commits/ .
tag: Short explanation of the commit Longer explanation explaining exactly what's changed and why, whether any external or private interfaces changed, what bugs were fixed (with bug tracker reference if applicable) and so forth. Be concise but not too brief. https://bugzilla.gnome.org/show_bug.cgi?id=123456
- The commit message is mainly for the other people, so they should be able to understand it now and six months later.
Always add a brief description of the commit to the first line of the commit and terminate by two newlines (it will work without the second newline, but that is not nice for the interfaces).
- First line (the brief description) must only be one sentence and should start with a capital letter unless it starts with a lowercase symbol or identifier. Don't use a trailing period either. It's recommended to not exceed 50 characters but it's not always possible/easy to follow this limit. In any case, don't exceed 72 characters.
- You can prefix the first line with one tag, to make it easier to know to which part of the module the commit applies. For example, a commit with "fish: Make it work with newer fortune" in the gnome-panel module clearly applies to the fish applet.
- The description part (the body) is normal prose and should use normal punctuation and capital letters where appropriate. Normally, for patches sent to a mailing list, the body is copied from there. This description part can be empty if the change is self-explanatory (eg: "Add DOAP file").
- Each line in description must not exceed 72 characters (there is no limit on number of lines).
When committing code on behalf of others use the --author option, e.g. git commit -a --author "Joe Coder <email@example.com>".
- If this commit is related to a bug on bugzilla.gnome.org, include a link to the bug at the bottom of the commit message, with one blank line above it.
- Use imperative form of verbs rather than past tense when referring to changes introduced by commit in question. For example "Remove property X" rather than "Removed property X".
It is very easy for developers (especially newcomers) to forget about the above points so its better to always go through this checklist for each patch before uploading it to bugzilla or pushing it to git.
- Summary line:
- Be sure to not exceed 72 characters. Try to not exceed 50.
- Use present tense. For example use "Add Hindi translation" instead of "Added Hindi translation".
- Summarize the change itself in the shortlog, not the bug or effects/benefits (that goes in description).
- Leave out the trailing period (full stop).
You can use '&' instead of 'and' so the message gets shorter.
- You can add a tag in lower cases with a colon before the rest.
- Describe it for everyone, not just for you.
- Add a blank line after it.
- Each line must not exceed 72 characters.
- You may leave out the description if the summary is self-explanatory.
- Use normal language and punctuation here.
- If the commit relates to a bug report, add a link to the bug.
- Give other users the credit they deserve. You would probably expect the same from others. (--author)
If you use git revert command to undo a commit, git generates a default commit message specifying the hash and commit message of the commit you're undoing, but this is not enough to know *why* you're reverting it, so please add more comments to it.