question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[all] Git Commit Message Style Guide

See original GitHub issue

Git Commit Message Style Guide

This is only a suggestion/discussion about adopting a commit message style guide

The following text was transcripted from Udacity Git Commit Message Style Guide. It also can be combined with other ideas, such as commit message emojis.

Introduction

There are many opinions on the ideal style in the world of development. Therefore, in order to reduce the confusion on what style students should follow during the course of their projects, we urge all contributors to refer to this style guide for this project.

Commit Messages

Message Structure

A commit messages consists of three distinct parts separated by a blank line: the title, an optional body and an optional footer. The layout looks like this:

type: subject

body

footer

The title consists of the type of the message and subject.

The Type

The type is contained within the title and can be one of these types:

  • feat: a new feature
  • fix: a bug fix
  • docs: changes to documentation
  • style: formatting, missing semi colons, etc; no code change
  • refactor: refactoring production code
  • test: adding tests, refactoring test; no production code change
  • chore: updating build tasks, package manager configs, etc; no production code change

The Subject

Subjects should be no greater than 50 characters, should begin with a capital letter and do not end with a period.

Use an imperative tone to describe what a commit does, rather than what it did. For example, use change; not changed or changes.

The Body

Not all commits are complex enough to warrant a body, therefore it is optional and only used when a commit requires a bit of explanation and context. Use the body to explain the what and why of a commit, not the how.

When writing a body, the blank line between the title and the body is required and you should limit the length of each line to no more than 72 characters.

The Footer

The footer is optional and is used to reference issue tracker IDs.

Example Commit Message

feat: Summarize changes in around 50 characters or less

More detailed explanatory text, if necessary. Wrap it to about 72
characters or so. In some contexts, the first line is treated as the
subject of the commit and the rest of the text as the body. The
blank line separating the summary from the body is critical (unless
you omit the body entirely); various tools like `log`, `shortlog`
and `rebase` can get confused if you run the two together.

Explain the problem that this commit is solving. Focus on why you
are making this change as opposed to how (the code explains that).
Are there side effects or other unintuitive consequences of this
change? Here's the place to explain them.

Further paragraphs come after blank lines.

 - Bullet points are okay, too

 - Typically a hyphen or asterisk is used for the bullet, preceded
   by a single space, with blank lines in between, but conventions
   vary here

If you use an issue tracker, put references to them at the bottom,
like this:

Resolves: #123
See also: #456, #789

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:6
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
jpventuracommented, Mar 20, 2017

@JoseAlcerreca, this and the Fernando Cejas project became the main references in community about Android architecture.

Several developers will start their own projects getting inspired by this one. Thus I believe that adopting some style will drive people how to organize their code history as well 😉

1reaction
JoseAlcerrecacommented, Mar 15, 2017

Many thanks!

However, I don’t think we need this. I prefer to deal with and teach newbies rather than to make everyone read and comply with a long list of rules.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Git Commit Style Guide - gists · GitHub
Rules for Commit Message ; Keep lines under 80 characters in width. Subject line must not be longer than 60 characters (one line...
Read more >
How to Write Good Commit Messages: A Practical Git Guide
How to write good commit messages · Separate the subject from the body with a blank line · Your commit message should not...
Read more >
Commit Styleguide — Dioptra 0.0.0 documentation - NIST Pages
This project follows precise rules over how git commit messages should be formatted. This leads to more readable messages that are easy to...
Read more >
Udacity Git Commit Message Style Guide
Udacity Git Commit Message Style Guide. Introduction. This style guide acts as the official guide to follow in your projects. Udacity evaluators will...
Read more >
Conventional Commits
The Conventional Commits specification is a lightweight convention on top of commit messages. It provides an easy set of rules for creating an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found