Skip to content

Commit format

Mario Romano edited this page Oct 25, 2017 · 6 revisions

Message

  • Do your best to give your commit a meaningful name that explains what it contains.
  • To make it easier to understand what the change is referring to, remember to put the issue id in your commit message.
  # good message
  git commit -m "[#issue-id] Fix upload button"

  # bad
  git commit -m "Fix upload button"

Good practice

  • Each commit should be a single logical change. Don't make several logical changes in one commit. For example, if a patch fixes a bug and optimizes the performance of a feature, split it into two separate commits.

  • Don't split a single logical change into several commits. For example, the implementation of a feature and the corresponding tests should be in the same commit.

  • Commit early and often. Small, self-contained commits are easier to understand and revert when something goes wrong.

  • Commits should be ordered logically. For example, if commit X depends on changes done in commit Y, then commit Y should come before commit X.