0% found this document useful (0 votes)
15 views7 pages

AngularJS Commit Message Guidelines

This document outlines the conventions for AngularJS Git commit messages, aiming to facilitate CHANGELOG generation, recognize unimportant commits, and enhance historical context. It details the format of commit messages, including type, scope, subject, body, and footer, along with examples of proper usage. The guidelines emphasize clarity and consistency to improve collaboration and code maintenance.

Uploaded by

Anusree
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views7 pages

AngularJS Commit Message Guidelines

This document outlines the conventions for AngularJS Git commit messages, aiming to facilitate CHANGELOG generation, recognize unimportant commits, and enhance historical context. It details the format of commit messages, including type, scope, subject, body, and footer, along with examples of proper usage. The guidelines emphasize clarity and consistency to improve collaboration and code maintenance.

Uploaded by

Anusree
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

AngularJS Git Commit Message

Conventions
Vojta Jina, Igor Minar

Goals
Generating [Link]
Recognizing unimportant commits
Provide more information when browsing the history
Format of the commit message
Revert
Message header
Allowed <type>
Allowed <scope>
<subject> text
Message body
Message footer
Breaking changes
Referencing issues
Examples

Goals
●​ allow generating [Link] by script
●​ allow ignoring commits by git bisect (not important commits like formatting
●​ provide better information when browsing the history

Generating [Link]
We use these three sections in changelog: new features, bug fixes, breaking changes.
This list could be generated by script when doing a release. Along with links to related commits.
Of course you can edit this change log before actual release, but it could generate the skeleton.

List of all subjects (first lines in commit message) since last release:
>> git log <last tag> HEAD --pretty=format:%s

New features in this release


>> git log <last release> HEAD --grep feature

Recognizing unimportant commits


These are formatting changes (adding/removing spaces/empty lines, indentation), missing semi
colons, comments. So when you are looking for some change, you can ignore these commits -
no logic change inside this commit.

When bisecting, you can ignore these by:


>> git bisect skip $(git rev-list --grep irrelevant <good place> HEAD)

Provide more information when browsing the history


This would add kinda “context” information.
Look at these messages (taken from last few angular’s commits):
●​ Fix small typo in docs widget (tutorial instructions)
●​ Fix test for [Link] - should remove old iframe
●​ docs - various doc fixes
●​ docs - stripping extra new lines
●​ Replaced double line break with single when text is fetched from Google
●​ Added support for properties in documentation

All of these messages try to specify where is the change. But they don’t share any convention...

Look at these messages:


●​ fix comment stripping
●​ fixing broken links
●​ Bit of refactoring
●​ Check whether links do exist and throw exception
●​ Fix sitemap include (to work on case sensitive linux)

Are you able to guess what’s inside ? These messages miss place specification...
So maybe something like parts of the code: docs, docs-parser, compiler, scenario-runner, …

I know, you can find this information by checking which files had been changed, but that’s slow.
And when looking in git history I can see all of us tries to specify the place, only missing the
convention.
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.

A commit message consists of a header, a body and a footer, separated by a blank line.

Revert
If the commit reverts a previous commit, its header should begin with `revert: `, followed by the
header of the reverted commit. In the body it should say: `This reverts commit <hash>.`, where
the hash is the SHA of the commit being reverted.

Message header​
The message header is a single line that contains succinct description of the change containing
a type, an optional scope and a subject.

Allowed <type>
This describes the kind of change that this commit is providing.
●​ feat (feature)
●​ fix (bug fix)
●​ docs (documentation)
●​ style (formatting, missing semi colons, …)
●​ refactor
●​ test (when adding missing tests)
●​ chore (maintain)

Allowed <scope>
Scope can be anything specifying place of the commit change. For example $location,
$browser, $compile, $rootScope, ngHref, ngClick, ngView, etc...

You can use * if there isn't a more fitting scope.

<subject> text
This is a very short description of the change.
●​ use imperative, present tense: “change” not “changed” nor “changes”
●​ don't capitalize first letter
●​ no dot (.) at the end

Message body
●​ just as in <subject> use imperative, present tense: “change” not “changed” nor
“changes”
●​ includes motivation for the change and contrasts with previous behavior

[Link]
[Link]

Message footer

Breaking changes

All breaking changes have to be mentioned as a breaking change block in the footer, which
should start with the word BREAKING CHANGE: with a space or two newlines. The rest of the
commit message is then the description of the change, justification and migration notes.

BREAKING CHANGE: isolate scope bindings definition has changed and


the inject option for the directive controller injection was removed.

To migrate the code follow the example below:

Before:

scope: {
myAttr: 'attribute',
myBind: 'bind',
myExpression: 'expression',
myEval: 'evaluate',
myAccessor: 'accessor'
}

After:

scope: {
myAttr: '@',
myBind: '@',
myExpression: '&',
// myEval - usually not useful, but in cases where the expression is assignable, you can
use '='
myAccessor: '=' // in directive's template change myAccessor() to myAccessor
}
The removed `inject` wasn't generaly useful for directives so there should be no code
using it.

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

feat($browser): onUrlChange event (popstate/hashchange/polling)

Added new event to $browser:


- forward popstate event if available
- forward hashchange event if popstate not available
- do polling when neither popstate nor hashchange available

Breaks $[Link], which was removed (use onUrlChange instead)

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 [Link] api, [Link] 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

style($location): add couple of missing semi colons

docs(guide): updated fixed docs from Google Docs

Couple of typos fixed:


- indentation
- batchLogbatchLog -> batchLog
- start periodic checking
- missing brace

feat($compile): simplify isolate scope bindings

Changed the isolate scope binding options to:


- @attr - attribute binding (including interpolation)
- =model - by-directional model binding
- &expr - expression execution binding

This change simplifies the terminology as well as


number of choices available to the developer. It
also supports local name aliasing from the parent.

BREAKING CHANGE: isolate scope bindings definition has changed and


the inject option for the directive controller injection was removed.

To migrate the code follow the example below:

Before:

scope: {
myAttr: 'attribute',
myBind: 'bind',
myExpression: 'expression',
myEval: 'evaluate',
myAccessor: 'accessor'
}

After:

scope: {
myAttr: '@',
myBind: '@',
myExpression: '&',
// myEval - usually not useful, but in cases where the expression is assignable, you can use '='
myAccessor: '=' // in directive's template change myAccessor() to myAccessor
}
The removed `inject` wasn't generaly useful for directives so there should be no code using it.

Common questions

Powered by AI

The 'BREAKING CHANGE' section in a commit message serves to notify developers of significant changes that will alter how certain components or the application itself operates, potentially introducing compatibility issues. It should be structured with a clear indication of the change, starting with the words 'BREAKING CHANGE:', followed by a description of what has changed, the justification for the change, and any necessary migration notes or instructions. This practice is crucial for maintaining the stability of the project during updates, ensuring developers are aware of necessary adjustments .

Including a detailed motivation for changes in the message body of a commit message can benefit future development by providing context that explains why a change was necessary, which aids in understanding the rationale behind decisions. Such context helps new developers onboard more effectively and assists in troubleshooting if similar issues arise later. It allows for a comprehensive understanding of the state of a system at a particular time, contributing to more informed decision-making and reducing the potential for redundant or contradictory changes .

Not having a well-defined commit message format can result in unclear commit histories, making it difficult to track changes and their purposes, which hinders collaboration and code maintenance. This lack of clarity can disrupt automated processes such as changelog generation, as these systems rely on structured metadata within commit messages to sort and categorize changes accurately. The absence of structure can lead to incomplete or misleading logs and ineffective automation, requiring more manual intervention and increasing the potential for human error .

Inconsistent commit messages lacking place specification pose challenges such as increased difficulty in navigating and understanding commit histories, which can slow down development processes and lead to integration errors. To mitigate these challenges, adopting a standardized format that includes a clear definition of the scope of each commit is essential. This involves training the team to consistently follow predefined conventions that specify scopes clearly, ensuring that all developers understand and adhere to these standards to maintain an organized and efficient workflow .

New directives like ng:disabled and ng:checked enhance attribute binding in older browsers by providing proper support for dynamically managing these attributes based on application state changes. They facilitate the binding of attributes in a way that is compatible with older browser behavior, ensuring that applications function correctly across different environments without requiring additional polyfills or complex workarounds. This supports consistency and reliability of UI behavior irrespective of the end user’s browser .

Categorizing commits into types such as 'feat' (feature), 'fix' (bug fix), and 'docs' (documentation) helps in project management by clearly indicating the nature and purpose of each change. This facilitates the integration of changes into the project, assists in the automated generation of changelogs, and allows developers to easily identify and prioritize tasks. Moreover, it contributes to more efficient project progress tracking by making it easier to assess what kind of changes are most frequently occurring and potentially need more attention or resources .

The primary purpose of using a structured commit message format is to generate a consistent and readable project history that facilitates tasks like generating a CHANGELOG.md automatically, recognizing unimportant commits, and providing clear information when browsing the history. This structured format allows developers to sort commits into categories such as new features, bug fixes, and breaking changes, enhancing the maintainability and navigation of the project's evolution .

Using imperative language in commit messages contributes to project coherence and readability by providing clear and consistent instructions on what changes the commit entails. This style implies action and immediacy, which aligns with the executable and actionable nature of code updates, making it easier for team members to understand the intention behind changes quickly. It reduces ambiguity and enhances the uniformity of message formats, facilitating better communication and understanding among developers .

Ignoring certain commits during tasks like git bisect is important as it helps focus only on substantive changes that affect the code logic or functionality, thereby speeding up the problem identification process. Unimportant commits such as those related to formatting (e.g., spaces, indentation) do not affect program behavior and thus can be skipped. This is achieved by using tools like `git bisect skip`, which allows developers to bypass commits identified as irrelevant, streamlining the debugging and troubleshooting processes .

Adopting a convention for specifying the scope in commit messages improves project clarity by precisely identifying the context or component affected by the change. This clarity aids developers in quickly understanding the impact of a commit without needing to examine the codebase extensively. It allows for better organization, easier navigation in version histories, and helps in correlating changes with the affected parts of the application, ultimately improving teamwork efficiency and project management .

You might also like