DEV Community

Rogério Rodrigues de Alcântara
Rogério Rodrigues de Alcântara

Posted on • Updated on

:wq cheats/git-commits

Git Commits

7 rules of a great Git commit message

  • #1 Keep in mind: This has all been said before.
  • #2 Separate subject from body with a blank line
  • #3 Limit the subject line to 50 characters
  • #4 Capitalize the subject line
  • #5 Do not end the subject line with a period
  • #6 Use the imperative mood in the subject line
  • #7 Wrap the body at 72 characters
  • #8 Use the body to explain what and why vs. how

Commit message structure

<type>[optional scope]: <Description>

[optional body]

[optional footer(s)]
Enter fullscreen mode Exit fullscreen mode

Examples

Commit with description and breaking change footer

feat: Allow provided config object to extend other configs

BREAKING CHANGE: `extends` key in config file is now used for extending other config files
Enter fullscreen mode Exit fullscreen mode

Commit with ! to draw attention to breaking change

feat!: Send email to the customer when product is shipped
Enter fullscreen mode Exit fullscreen mode

Commit with scope and ! to draw attention to breaking change

feat(api)!: Send email to the customer when product is shipped
Enter fullscreen mode Exit fullscreen mode

Commit with both ! and BREAKING CHANGE footer

chore!: Drop support for Node 6

BREAKING CHANGE: use JavaScript features not available in Node 6.
Enter fullscreen mode Exit fullscreen mode

Commit with no body

docs(CHANGELOG): Correct spelling
Enter fullscreen mode Exit fullscreen mode

Commit with scope

feat(lang): Add Polish
Enter fullscreen mode Exit fullscreen mode

Commit with multi-paragraph body and multiple footers

fix(requests): Prevent racing

Introduce a request id and a reference to latest request.

Also:
- Dismiss incoming responses other than from latest request.
- Remove timeouts which were used to mitigate the racing issue but are obsolete now.

Refs: #123
Enter fullscreen mode Exit fullscreen mode

Tooling


References

Top comments (0)