Git Commit Messages

Git is a tool that straightway out of Linux Kernel development. It is the mechanism by which code is updated and pushed back into the Linux Kernel as Linux continues to roll forward. It is a very robust source control system and provides the ability to clone repositories for local use.

Git commit messages are something worthy of comment.

In General

The first line is known as the subject line and should contain a tag calling out a reference to what relevant area in the code. The last paragraph is known as the footer and contains all the relevant tags for the commit itself.

Keep changes small. There should be one logical change per commit:

  • Smaller commits are easier to review
  • Easier to revert
  • Easier to identify where a problem was first introduced
  • Git History easier to review

Things to Avoid

  • Mixing whitespace changes with functional code changes; Instead, create two commits:
  • one for whitespace changes and one for functional changes
  • Combining two unrelated functional code changes
  • Sending big features in a single, large commit

Example

In general, commit messages should follow the 50/72 guideline in that the subject or first line should be less than 50 characters, followed by a space, and every subsequent line to be less than 72 characters. Additional tags can be represented by tagname colon in the footer.

Comments are closed.

Search

Websites

  • slide
  • slide
  • slide
  • slide