To write a good commit message, follow these guidelines:
-
Use the Imperative Mood: Write the message as if you are giving a command. For example, use "Add feature" instead of "Added feature" or "Adding feature."
-
Keep It Short and Concise: Aim for a summary of around 50 characters for the subject line. If you need to provide more detail, add a blank line and then include a more detailed explanation.
-
Be Descriptive: Clearly explain what changes were made and why. This helps others (and your future self) understand the context of the changes.
-
Reference Issues or Tickets: If applicable, reference any related issue numbers or tickets to provide additional context.
-
Avoid Generic Messages: Instead of vague messages like "Fix stuff," be specific about what was fixed or changed.
Example Format:
Short summary of the changes (50 characters or less)
Detailed explanation of the changes, if necessary.
You can include any relevant information, such as
why the change was made or how it affects the project.
Example Commit Message:
Fix bug in user authentication
Corrected the logic in the login function to handle
invalid credentials properly. This resolves issue #42.
Following these guidelines will help ensure your commit messages are clear and useful for anyone reviewing the project history.
