@@ -108,17 +108,60 @@ in the further progress of the project.
108108Write meaningful commit messages
109109--------------------------------
110110
111+ .. figure :: git_commit.png
112+ :alt: Git commit messages
113+
114+ xkcd: `Git Commit <https://xkcd.com/1296/>`_
115+
116+ Merge branch 'asdfasjkfdlas/alkdjf' into sdkjfls-final
117+
111118By creating insightful and descriptive commit messages, you make working in a
112119team a lot easier. They allow others to understand your changes. They are also
113120helpful at a later point in time to understand which goal should be achieved
114- with the code.
121+ with the code. A diff can tell you exactly what has changed, but the commit
122+ message can also tell you **why **.
123+
124+ Just as the :doc: `Python Style Guide <python-basics:style >` defines conventions
125+ for naming, formatting, :abbr: `etc. ( et cetera ) `, a team should also agree on
126+ conventions for commit messages. These should at least define style, content and
127+ metadata:
128+
129+ Style
130+ markup syntax, grammar, capitalisation and punctuation.
131+ Content
132+ What content should the body of the commit message contain? And what should
133+ it not contain?
134+ Metadata
135+ How should issue IDs, pull requests etc. be referenced?
136+
137+ Fortunately, there are already established conventions as to what constitutes a
138+ typical Git commit message. So you don’t have to reinvent anything. Just follow
139+ these seven rules and you’ll be on the right track:
140+
141+ #. Separate the subject from the text with a blank line.
142+ #. Limit the subject line to 50 characters.
143+ #. Capitalise the subject line.
144+ #. Do not end the subject line with a full stop.
145+ #. Use the imperative in the subject line.
146+ #. Limit the body text to 72 characters per line.
147+ #. Explain the **what ** and **why ** in the body text, not the how.
115148
116- Usually short messages, 50–72 characters long, should be specified and
117- displayed on one line, eg with ``git log --oneline ``.
118-
119- With ``git blame `` you can later specify for each line in which revision and
120- by which author the change was made. You can find more information on this in
121- the Git documentation: `git-blame <https://git-scm.com/docs/git-blame >`_.
149+ .. seealso ::
150+ * Tim Pope: `A Note About Git Commit Messages
151+ <https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html> `_
152+ * Pro Git: `Commit Guidelines
153+ <https://www.git-scm.com/book/en/v2/Distributed-Git-Contributing-to-a-Project#_commit_guidelines> `_
154+ * Linus Torvalds: `Contributing
155+ <https://github.com/torvalds/subsurface-for-dirk/blob/master/README.md#contributing> `_
156+ * Peter Hutterer: `On commit messages
157+ <http://who-t.blogspot.com/2009/12/on-commit-messages.html> `_
158+ * Erlang/OTP: `Writing good commit messages
159+ <https://github.com/erlang/otp/wiki/writing-good-commit-messages> `_
160+ * spring-framework: `Format commit messages
161+ <https://github.com/spring-projects/spring-framework/blob/30bce7/CONTRIBUTING.md#format-commit-messages> `_
162+
163+ Gitmojis
164+ ~~~~~~~~
122165
123166If you use gitmojis in your commit messages, you can easily see the intent of
124167the commit later.
0 commit comments