Microsoft Dev Blogs

Write Your Git Commits with GitHub Copilot

thumbnail

Write Your Git Commits with GitHub Copilot

Summary:

The latest Visual Studio preview introduces a new feature that utilizes GitHub Copilot AI to generate Git commit messages. This feature aims to make it easier for developers to describe their code changes, leading to more effective code reviews and a clearer Git history. By simply clicking a button, developers can generate a descriptive commit message and then provide their own explanation.

Key Benefits:

  • Avoids repositories with unclear commit messages
  • Allows teammates to more effectively review changes in pull requests
  • Provides a clear story within the Git history, including both "what" and "why" changes were made
  • Simplifies troubleshooting by easily pinpointing the origin of bugs or breaking changes
  • Saves time by making repositories easier to ramp up to and contribute to in the future

How it Works:

  1. Download the latest Visual Studio preview and update the GitHub Copilot Chat Extension
  2. Use the new "Add AI Generated Commit Message" icon in the Git Changes window
  3. GitHub Copilot will analyze file changes in the commit and generate a summary and description for each change
  4. Choose to "Insert AI Suggestion" or "Discard" the generated commit message

Feedback:

Developers are encouraged to provide feedback on this new feature to help improve the overall experience. Feedback can be shared through the provided survey or via the Developer Community. This feedback is valuable in shaping the future of Visual Studio.

Conclusion:

The new Generated Commit Message feature in Visual Studio, powered by GitHub Copilot AI, simplifies the process of writing descriptive and helpful Git commit messages. By utilizing this feature, developers can enhance productivity, improve code reviews, and make their repositories more accessible to future contributors.