-
Notifications
You must be signed in to change notification settings - Fork 0
Commit Messages Best Practices
It is important to keep the commit messages tidy since many tools depend on having good formatted messages to produce "nice" output. Usually you want to avoid using the option -m because you can't easily format your message that way. Configure git to open your preferred your text editor to write your commit message.
$ git commit -s
Example commit with a good formatted message:
Creation of xoptions.icn - an alternative for options.icn
This file contains an extended (highly modified) version of a command
line argument processing procedure. It includes more POSIX and GNU
command line processing as well as additional changes and extensions.
Signed-off-by: Bruce Rennie <[email protected]>
Explain the commit in one line (60 character limit). The header line should be meaningful. It should summarize the change in one readable line of text,independently of the longer explanation. It is what is shown by many git tools and log commands.
Explain the commit in details possibly with a few lines of text. Leave an empty line after the commit header. Give background about the issue being fixed or the new feature being introduced. Keep columns shorter than 74 characters.That way "git log" will display the commit message nicely even when it's indented.
Add a Signed-off-by line to commit messages by adding a line at the end of the commit message that looks like this:
Signed-off-by: Your Name <[email protected]>
This line certifies that your contributions adhere to the requirements by https://developercertificate.org/
git has a command option (-s) to automatically sign-off your commits:
$ git commit -s -m 'This is my commit message'