Skip to content

Add commit messages documentation#156

Open
runephilosof-abtion wants to merge 1 commit intomainfrom
runephilosof-abtion-patch-2
Open

Add commit messages documentation#156
runephilosof-abtion wants to merge 1 commit intomainfrom
runephilosof-abtion-patch-2

Conversation

@runephilosof-abtion
Copy link
Member

Hopefully, this will result in commit messages that are more valuable when you dig back in the code history.

Hopefully this will result in commit messages that are more valuable when you dig back in the code history.
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @runephilosof-abtion, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new documentation file dedicated to establishing best practices for writing commit messages. The primary aim is to enhance the clarity and value of the project's commit history, making it easier for developers to understand the rationale and context behind code changes. By providing clear guidelines, this change seeks to improve long-term maintainability and collaboration.

Highlights

  • New Documentation Added: A new Markdown file, technical_practices/commit_messages.md, has been added to the repository.
  • Commit Message Guidelines: This new document provides comprehensive guidelines for writing effective and valuable commit messages, emphasizing the 'why' behind changes.
  • Best Practices: The guidelines include 'nice to have' elements such as change summaries, decision rationales, relevant links (e.g., Asana tasks, bug reports), and a recommendation to keep headlines concise (under 50 characters).
  • External Reference: A link to a freeCodeCamp article on writing better Git commit messages is included for further reading and detailed advice.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds valuable documentation on writing good commit messages. I've suggested a more structured format for the document to make the guidelines clearer and more actionable for developers. The proposed structure includes sections for the headline, body, and footer of a commit, and also adds references to common conventions like using the imperative mood and the Conventional Commits specification. This should help achieve the goal of making commit history more valuable.

Comment on lines +1 to +17
# Commit Messages

The most important information in commit messages is *why* you made the change.

Nice to have:

* Summary of the changes (it helps when going back in history and trying to decide whether a change was accidentally added to commit).
* Thoughts about decisions you made.
* Links to Asana task, or other relevant info like a Github bug report, stackoverflow, etc.
* Keep the headline less than 50 characters, if possible.

https://www.freecodecamp.org/news/how-to-write-better-git-commit-messages/
> To come up with thoughtful commits, consider the following:
> * Why have I made these changes?
> * What effect have my changes made?
> * Why was the change needed?
> * What are the changes in reference to?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This is a great start for documenting commit message best practices. To make it even more effective and easier for developers to follow, I suggest restructuring the entire document. A more formal structure with sections for Headline, Body, and Footer can provide clearer, actionable guidance. This revised structure incorporates all your original points while also adding other common best practices, like using the imperative mood and linking to the Conventional Commits standard. It also aligns the formatting with other documentation files in the repository by using a 'Further reading' section.

# Commit Messages

The most important information in a commit message is *why* you made the change. A well-crafted commit message is a gift to your future self and your teammates.

## Structure of a good commit message

A commit message consists of a headline (or subject), an optional body, and an optional footer.

### Headline
The headline should be a concise summary of the change.
* Keep it under 50 characters if possible.
* Write it in the imperative mood (e.g., "Fix login bug" not "Fixed login bug").

### Body (Optional but recommended)
The body is where you explain the context and the *why*.
* Explain the problem this change is solving.
* Describe the decisions you made and their rationale.
* Summarize the changes if the headline isn't sufficient.

### Footer (Optional)
The footer is for metadata.
* Link to Asana tasks, GitHub issues, or other relevant resources (e.g., `Fixes #123`, `Refs: ASANA-456`).

## Guiding Questions
To help write a thoughtful commit message, consider these questions:
* Why is this change necessary?
* How does it address the issue?
* What effects does this change have?

## Further reading
* [How to Write Better Git Commit Messages](https://www.freecodecamp.org/news/how-to-write-better-git-commit-messages/)
* [Conventional Commits](https://www.conventionalcommits.org/)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants