Git commit messages standard

7 years ago

David Grudl
Nette Core | 6827
+
0
-

I'd like to create a coding style for commit messages. It might help contributors in writing comprehensive summaries.

Subject is the first line of the commit message which should be enough to know what it is about.

  • Subject should be not longer than 70 characters.
  • Subject must be in the past tense (writing commits and reading a commit history is much more natural, so please, don't discuss this now).
  • It is needed to easily distinguish between fixing, adding/changing nad merging commits. So subject must start with one of these verbs:
    • Added (new feature)
    • Fixed (bug fix, may include #issue-number)
    • Refactored (change in code without changing its behavior)
    • Merge/Revert (generated only by Git)
    • Typos (I know, it is not a verb…)
    • other verbs could be allowed for “changing” commits (Changed, Updated, Removed, Deprecated, …)
  • Subject must cleary identify part of framework which commit affects (Database, tests, …)
  • The BC break must be indicated in subject.

In other words: it should be possible to generate changelog like this from commit log.

After a subject there can be one empty line and other description, link to forum etc.

7 years ago

David Grudl
Nette Core | 6827
+
0
-

Ideas, examples:

Latte: fixed multi template rendering [Closes #269]

Latte: fixed #269 multi template rendering

[Latte] Fixed #269 multi template rendering

[Fixed #269] Latte: multi template rendering

Example of bad commit message is UI\Presenter: user services are passed via constructor instead of setContext(). Better:

UI\Presenter: changed the method used to pass user services to presenter from setContext() to constructor

[Application] Changed the method used to pass user services to presenter from setContext() to constructor

7 years ago

paranoiq
Member | 388
+
0
-

i like the first one: Latte: fixed multi template rendering [Closes #269]
and it has been used in most messages since now

but the wrong example seems to me more understandable than both ‘better’ messages :[

7 years ago

Milo
Nette Core | 1125
+
0
-

I like the first one too. Square brackets evoke some kind of link.

What about deeper namespace classes? First example seems fine to me.

Database: fixed method getColumns() in PgSqlDriver
Database: PgSqlDriver: fixed method getColumns()
PgSqlDriver: fixed method getColumns()