Write Your Git Commits with GitHub Copilot

Jessie Houghton

After spending hours on a bug fix or a feature update, often the last thing we developers want to do is carefully explain the contents of the Git commit. The latest Visual Studio preview is here to help. Use the new generated Git commit message feature to help you describe your set of changes. You can then refine the message with “why” the change was made and commit.

Image AI Generated Commit 1

Generating useful and informative commit messages helps you in a variety of ways.

  • You avoid your repository looking like this

Poor Git history example

  • Your teammates can more effectively review your changes in a pull request
  • Your Git history tells a story that includes both “what” was changed and “why”
  • You can easily pinpoint the origins of a bug or breaking change
  • You save yourself and/or coworkers hours of digging around while troubleshooting
  • You make your repository easier to ramp up to and contribute to in the future

Enable the feature

This feature is currently only available in preview. Ensure it’s enabled in Tools > Options > GitHub > Copilot chat > Enable commit message suggestions

To try it out, download the latest Visual Studio preview and update the GitHub Copilot Chat Extension. You’ll also need an active GitHub Copilot subscription.

What is the generated Git commit message feature?

The new Generated Commit Message feature uses GitHub Copilot AI to describe your code changes.  This makes writing descriptive and helpful commit messages as easy as clicking a button, then adding your explanation.

generated Git commits with GitHub Copilot

Use the new “Add AI Generated Commit Message” sparkle pen icon in the Git Changes window to generate a suggestion. GitHub Copilot will look at the file changes in your commit, summarize them, and then describe each change. You can then “Insert AI Suggestion” or “Discard.”

generated Git commits with GitHub Copilot suggestion

Let us know what you think

We hope this new feature makes writing your Git commit messages easier – leading to productivity for you, your teammates, and even “future you” when reviewing your changes and helping others understand your Git history. Share your thoughts with us, so we can continue to improve your experience.

We appreciate the time you’ve spent reporting issues/suggestions and hope you continue to give us feedback when using Visual Studio on what you like and what we can improve. Your feedback is critical to help us make Visual Studio the best tool it can be! You can share feedback with us via Developer Community: report any bugs or issues via report a problem and share your suggestions for new features or improvements to existing ones.

Stay connected with the Visual Studio team by following us on YouTube, Twitter, LinkedIn, Twitch and on Microsoft Learn.


Discussion is closed. Login to edit/delete existing comments.

  • dexi lin 4

    Can I generate in my native language, such Chinese?

    • Jessie HoughtonMicrosoft employee 1

      Because this is supported by Copilot chat, and the responses are currently limited to English, we cannot support other languages, yet. Please suggestion a feature on Developer Community to help collect community support for this suggestion.

  • Ataru Moroboshi 4

    Uhm… The title that is three lines long? No thanks

  • Maxim 4

    A good place for such detailed explanation is PR description, not commit message.

  • liam-cannon 4

    That seems like a little more than 50 characters.

  • Jeff Lefebvre 4

    This is real close! However, commit messages should follow the 50/72 rule. If it’s going to be automated with copilot, the 50/72 rule should be added to its instruction prompt.

    As it is, if my team were to use commit messages like the example above, the code history will become unnavigable over time.

  • Amr Swalha 0

    A good idea is not to allow the generic AI one, at least 30% of it must be by hand

  • Stephen Miller 1

    Hi Jessie, I am excited to use this feature, but cannot get the ‘sparkle’ button to show up in the commit message window. I have installed Visual Studio 17.9.0 Preview 1.1 (which is the lastest as of this post), and followed all of the instructions here to get the feature enabled. I have both GitHub Copilot and GitHub Copilot chat extensions installed. I know Copilot is working because I use it for suggestions when coding. In the Tools->Options->GitHub->Copilot chat->Enable commit message suggestions is checked. Still no sparkle button… What am I doing wrong or what else can I check? Thanks, Steve

  • Mario Wong 0

    May i know how many code data (or it is just limited to current section for code diff?) was sent to the AI engine (is the AI engine cloud base or running under our local machine?) for generating and analysis the commit changes?

  • Ricardo Marques 1

    I know that this is the visual studio blogs but does anyone know if this is possible to use this feature from the CLI? I love VSCode and GitHub Copilot but I still do most of my commits and git management in the terminal as I feel like I am faster that way. I would absolutely love to use this feature however.

    Looking forward to a reply!

  • Lars Henrik Mostad Haugeli 1

    I was really eager to try this, but I am really disappointed since the text generated is WAY too long. It should be limited to 1-3 lines. Or we should be able to insert our own prompt in settings of the extension. Is there anywhere I can request a feature request for the extension?

Feedback usabilla icon