Skip to content

Instantly share code, notes, and snippets.

@tuantmdev
Last active July 8, 2016 08:24
Show Gist options
  • Select an option

  • Save tuantmdev/2747caf00ade572f2aba4e10a68c2635 to your computer and use it in GitHub Desktop.

Select an option

Save tuantmdev/2747caf00ade572f2aba4e10a68c2635 to your computer and use it in GitHub Desktop.
Git conventions and best practices

Git conventions

Github workflow

IMPORTANT!! Everything you need to know about this amazing workflow in here: Github guides

Commit message

Format of the commit message

<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>

Any line of the commit message cannot be longer 100 characters! This allows the message to be easier to read on github as well as in various git tools.

Subject line

Subject line contains succinct description of the change.

Allowed <type>
  • feat (feature)
  • fix (bug fix)
  • docs (documentation)
  • style (formatting, missing semi colons, …)
  • refactor
  • test (when adding missing tests)
  • chore (maintain)
Allowed <scope>

Scope could be anything specifying place of the commit change. For example $location, $browser, $compile, $rootScope, ngHref, ngClick, ngView, etc...

<subject> text
  • use imperative, present tense: “change” not “changed” nor “changes”
  • don't capitalize first letter
  • no dot (.) at the end
Tip
  • If it seems difficult to summarize what your commit does, it may be because it includes several logical changes or bug fixes, and are better split up into several commits

Message body

  • just as in use imperative, present tense: “change” not “changed” nor “changes”
  • includes motivation for the change and contrasts with previous behavior

Message footer

Breaking changes

All breaking changes have to be mentioned in footer with the description of the change, justification and migration notes

Referencing issues

Closed bugs should be listed on a separate line in the footer prefixed with "Closes" keyword like this:

Closes #234

or in case of multiple issues:

Closes #123, #245, #992

Examples

fix($compile): couple of unit tests for IE9

Older IEs serialize html uppercased, but IE9 does not...
Would be better to expect case insensitive, unfortunately jasmine does
not allow to user regexps for throw expectations.

Closes #392
Breaks foo.bar api, foo.baz should be used instead
feat(directive): ng:disabled, ng:checked, ng:multiple, ng:readonly, ng:selected

New directives for proper binding these attributes in older browsers (IE).
Added coresponding description, live examples and e2e tests.

Closes #351
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment