Skip to content

Git Commit Guidelines

cbcercas edited this page May 27, 2017 · 1 revision

Commit Message Format

Each commit message consists of a header, a body(if needed). The header has a special format that includes a type, a scope and a subject:

[type]<scope>: <subject>
<BLANK LINE>
<body>

The header is mandatory and the scope of the header is the affected module.

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.

Revert

If the commit reverts a previous commit, it 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.

Type

Must be one of the following:

  • FEATURE: A new feature
  • FIX: A bug fix
  • DOCS: Documentation only changes
  • NORME: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • REFACTOR: A code change that neither fixes a bug nor adds a feature
  • PERF: A code change that improves performance
  • TEST: Adding missing or correcting existing tests
  • CHORE: Changes to the build process or auxiliary tools and libraries such as documentation generation

Scope

The scope could be anything specifying place of the commit change. For example Lexer, Parser, Ui, Builtins, etc...

You can use * when the change affects more than a single scope.

Subject

The subject contains succinct description of the change:

  • use the imperative, present tense: "change" not "changed" nor "changes"
  • capitalize first letter
  • no dot (.) at the end
  • when a fix need to be linked to an issue add (Fix #00). More info can be found here

Body (if needed)

Just as in the subject, use the imperative, present tense: "change" not "changed" nor "changes". The body should include the motivation for the change and contrast this with previous behavior.

BREAKING CHANGE If a modification can break some code please explain it add the end of the body like: ` BREAKING CHANGE: moving t_env *env to a sigleton.

BREAKING CHANGE: to migrate the code follow the example below:

Before:
env need to be passed by function parameter like:
  char	**sh_tenv_to_tab(t_env *env)
  {...}

After:
you need to call sh_get_envs() to get the envs like:
char	**sh_tenv_to_tab(void)
{
    t_env	*env;

    envs = sh_get_envs();
    (...)
}

`

Clone this wiki locally