Skip to content

Instantly share code, notes, and snippets.

@rantoniuk
Last active September 2, 2019 13:46
Show Gist options
  • Select an option

  • Save rantoniuk/d92ebec45711ca8d85d0049852f3014c to your computer and use it in GitHub Desktop.

Select an option

Save rantoniuk/d92ebec45711ca8d85d0049852f3014c to your computer and use it in GitHub Desktop.

Revisions

  1. @warden warden revised this gist Sep 2, 2019. 1 changed file with 16 additions and 1 deletion.
    17 changes: 16 additions & 1 deletion git-commit-guidelines.md
    Original file line number Diff line number Diff line change
    @@ -29,10 +29,25 @@ When a button is pressed on the mobile, the remote coffee machine
    will start coffee preparation process
    ```

    ### Bad examples

    ```
    Fixed proj-123
    ```

    ```
    Fixed a bug in class Z.
    ```

    ```
    - enabled the flag
    ```

    Guidance for well-written commit messages:

    * separate subject from body with a blank line
    * use the imperative mood in the subject line
    * use the imperative mood in the subject line, e.g. "Fix broken image" instead
    of "Fixed broken image"
    * do not end the subject line with a period
    * capitalize the subject line and each paragraph
    * wrap lines at 72 characters
  2. @warden warden renamed this gist Sep 2, 2019. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. @warden warden created this gist Sep 2, 2019.
    67 changes: 67 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,67 @@
    Commit Message Guidelines

    Example of a properly formed commit message:

    ```
    JIRA-123 Short (72 chars or less) summary

    More details about the change, including functional and/or technical
    explanation. Wrap it to 72 characters. The blank line separating the
    summary from the body is critical (unless you omit the body entirely).

    Further paragraphs come after blank lines.

    - Use bullet points if needed (preceded with hyphen or an asterisk, use
    MarkDown notation if possible)
    ```


    ### Good examples

    ```
    Fix color of the inbox message on the welcome screen
    ```

    ```
    [#123] Add option to fix myself a coffee with a button

    When a button is pressed on the mobile, the remote coffee machine
    will start coffee preparation process
    ```

    Guidance for well-written commit messages:

    * separate subject from body with a blank line
    * use the imperative mood in the subject line
    * do not end the subject line with a period
    * capitalize the subject line and each paragraph
    * wrap lines at 72 characters

    Use the body to explain what and why you have done something.
    In most cases, you can leave out details about how a change has been made.
    Some questions that can aid in formulating explanation section:

    * The first commit line is the most important
    * Describe why a change is being made
    * How does it address the issue?
    * Do not assume the reviewer understands what the original problem was
    * Do not assume the code is self-evident/self-documenting
    * Read the commit message to see if it hints at improved code structure
    * Describe any limitations of the current code


    Referencing ticket systems:

    ```
    [#123] Refer to GitHub issue...
    JIRA-123 Refer to Jira ticket with project identifier JIRA...

    Fixes #123, JIRA-345 by introducting new class parameter.

    ```

    Sources
    - https://wiki.openstack.org/wiki/GitCommitMessages
    - http://chris.beams.io/posts/git-commit/
    - http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
    - https://confluence.atlassian.com/bitbucket/use-smart-commits-298979931.html