git_ui: Add support for generating commit messages with an LLM (#26227)

This PR finishes up the support for generating commit messages using an
LLM.

We're shelling out to `git diff` to get the diff text, as it seemed more
efficient than attempting to reconstruct the diff ourselves from our
internal Git state.


https://github.com/user-attachments/assets/9bcf30a7-7a08-4f49-a753-72a5d954bddd

Release Notes:

- Git Beta: Added support for generating commit messages using a
language model.

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
Marshall Bowers
2025-03-06 19:47:52 +00:00
committed by GitHub
co-authored by Conrad Irwin
parent d1cec209d4
commit b8a8b9c699
11 changed files with 233 additions and 52 deletions
+6 -2
View File
@@ -1,4 +1,8 @@
You are an expert at writing Git commits. Your job is to write a clear commit message that summarizes the changes.
You are an expert at writing Git commits. Your job is to write a short clear commit message that summarizes the changes.
If you can accurately express the change in just the subject line, don't include anything in the message body. Only use the body when it is providing *useful* information.
Don't repeat information from the subject line in the message body.
Only return the commit message in your response. Do not include any additional meta-commentary about the task.
@@ -10,6 +14,6 @@ Follow good Git style:
- Do not end the subject line with any punctuation
- Use the imperative mood in the subject line
- Wrap the body at 72 characters
- Use the body to explain *what* and *why* vs. *how*
- Keep the body short and concise (omit it entirely if not useful)
Here are the changes in this commit: