Skip to content

Instantly share code, notes, and snippets.

@paulera
Forked from lucasmezencio/commit_message.md
Created May 22, 2019 10:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulera/47e97782599f246acfc0160a9c389773 to your computer and use it in GitHub Desktop.
Save paulera/47e97782599f246acfc0160a9c389773 to your computer and use it in GitHub Desktop.
Como escrever a mensagem de um commit

As mensagens dos commits devem servir para três importantes coisas:

  • Para acelerar o processo de revisão.
  • Para ajudar a escrever uma boa nota de lançamento.
  • Para ajudar os futuros mantenedores (que pode ser você), ou ajudar a descobrir porque uma mudança foi feita no código ou porque uma funcionalidade foi adicionada.

Escreva sua mensagem de commit desta forma:

[Só use TAG em casos específicos] Resuma claramente o commit em uma linha e em até 72 caracteres

Descreva o problema que o commit resolve ou o caso de uso que levou a 
nova funcionalidade. Justifique porque você escolheu essa solução.
Não descreva o código. Descreva o propósito e a abordagem utilizada.

TAGS PERMITIDAS

  • [tag] : Criação de uma tag
  • [-tag] : Remoção de uma tag
  • [branch] : Criação de um branch
  • [-branch] : Remoção de um branch
  • [merge] : Junção de códigos, ponto crítico

FAÇA

  • Escreva a linha de resumo e a descrição de modo imperativo, como se estivesse comandando alguém. Escreva: "adiciona", "remove", "atualiza" ao invés de "adicionado", "removido", "atualizado".

  • O resumo deve ser apenas uma frase e deve começar com uma letra maiúscula.

  • Sempre deixe em branco a segunda linha.

  • Quebre as linhas da descrição do commit para que não fiquem muito extensas. (Para tornar a mensagem legível sem ter que rolar horizontalmente).

NÃO FAÇA

  • Não termine a linha de resumo com pontuação e não exceda 72 caracteres.

DICAS

  • Se parece difícil resumir o que o seu commit faz, o motivo talvez seja diversas alterações lógicas ou correções de erros. Nesse caso, deve ser dividido em vários commits.

REFERÊNCIAS

The commit messages must be to three important things:

  • To accelerate the revision process.
  • To help write a good release note.
  • To help future maintainers (that can be you), or help to discover why a change has been made in the code or why a feature has been added.

Write your commit message this way:

[Only use TAG in specific cases] Clearly summarize the commit in a single line and up to 72 characters.

Describe the problem you commit solves or the use case that led to
new functionality. Justify why you chose this solution.
Do not describe the code. Describe the purpose and the approach used.

ALLOWED TAGS

  • [tag] : Adding a new tag
  • [-tag] : Removing a tag
  • [branch] : Adding a new branch
  • [-branch] : Removing a branch
  • [merge] : Merging codes, critic point

DO

  • Write the summary line and the imperative mode of description, as if commanding someone. Type: "add", "remove", "update" instead of "added", "removed", "updated".

  • The summary should be one sentence and must start with a capital letter.

  • Always leave the second line blank.

  • Break the commit description lines that do not become too large. (To make the message readable without having to scroll horizontally).

DO NOT

  • Do not end the summary line with score and do not exceed 72 characters.

TIPS

  • If it seems difficult to summarize what your commit is, the reason may be multiple logical changes or bug fixes. In this case, should be divided into several commits.

REFERENCES

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