# AI git commit messages

**URL:** <https://forum.cursor.com/t/ai-git-commit-messages/1027>\
**Category:** Feature Requests\
**Created:** [October 12, 2023, 7:21am UTC](https://forum.cursor.com/t/ai-git-commit-messages/1027 "2023-10-12T07:21:08Z")\
**Posts on this page:** 12\
**Page:** 2

<div class="post-metadata">

**Author:** ![gokcin](https://avatars.discourse-cdn.com/v4/letter/g/45deac/32.png) [@gokcin](https://forum.cursor.com/u/gokcin)\
**Post date:** [September 16, 2024, 8:26pm UTC](https://forum.cursor.com/t/ai-git-commit-messages/1027/21 "2024-09-16T20:26:36Z")

</div>

@hugodemenez

I think you can partially accomplish automatic custom commit messages with a button click using the following:

- A markdown file describing your commit instructions with a prompt on a repo
- The doc crawling feature of cursor
- The `@Commit (Diff of Working State` or `@PR (Diff with Main Branch` contexts.

You can even support custom flags of your own. Here is what I do which combines some cool tricks I learned in this forum and the things I figured out by myself after spending quite some time with cursor.

- Create a repo or a gist(private repo also works) to store your prompt(s)(mine is here [dotfiles/ai-stuff/cursor/prompts/create-commit/system.md at main · dgokcin/dotfiles (github.com)](https://github.com/dgokcin/dotfiles/blob/main/ai-stuff/cursor/prompts/create-commit/system.md)
- Add the URL of the markdown prompt as a doc to cursor (`Cursor -> Settings -> Cursor Settings -> Features -> Docs -> Add new doc`)
- Name it as `@create-commit` or something similar

When you wanna commit just use cursor chat to call your commit prompt with the diff context.

`@create-commit @Commit (Diff of Working State) `

or

`git diff | pbcopy` in your terminal and than `@create-commit <paste-with-command-v>` in cursor chat (as mentioned above, there is no context for the staged changes in cursor yet)

If you manage the force the prompt to output the git commit under a markdown codeblock with `bash` as the language in your prompt(claude-3.5-sonnet seems quite consistent for me as well as figuring out the changes the way I want) than this makes it runnable in yor shell creating a run button, on top right corner.

 ![image](https://us1.discourse-cdn.com/cursor1/original/2X/8/8f566a54941ba9c925c2375e8f119c17199ae8bd.png)

This may be a little bit overkill for some if you are used to the copilot extension but I find this method quite extendable and practical.

---

<div class="post-metadata">

**Author:** ![hugodemenez](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/hugodemenez/32/5009_2.png) [@hugodemenez](https://forum.cursor.com/u/hugodemenez)\
**Post date:** [September 18, 2024, 1:49pm UTC](https://forum.cursor.com/t/ai-git-commit-messages/1027/22 "2024-09-18T13:49:12Z")

</div>

Nice tip ! Thanks for your recommendation, indeed looks good ! As you say a bit overkill ahah

---

<div class="post-metadata">

**Author:** ![ValentinViennot](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/valentinviennot/32/5306_2.png) [@ValentinViennot](https://forum.cursor.com/u/ValentinViennot)\
**Post date:** [September 18, 2024, 2:30pm UTC](https://forum.cursor.com/t/ai-git-commit-messages/1027/23 "2024-09-18T14:30:20Z")

</div>

+1 ☺ would be great to have an auto-updating commit message from staged changes without custom prompt/trick needed!

---

<div class="post-metadata">

**Author:** ![blackjak231](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/blackjak231/32/5318_2.png) [@blackjak231](https://forum.cursor.com/u/blackjak231)\
**Post date:** [September 18, 2024, 3:47pm UTC](https://forum.cursor.com/t/ai-git-commit-messages/1027/24 "2024-09-18T15:47:10Z")

</div>

Funny enough, this is exactly what I’ve been doing for the past weeks 🙂 I even configured it to give me the “git add” command and to split the diffs into multiple commits if necessary. Now I almost just need to one click “run” 🙂

The only (important) downside : the @gitdiff does not return file removals and file additions… Always double check !

---

<div class="post-metadata">

**Author:** ![gokcin](https://avatars.discourse-cdn.com/v4/letter/g/45deac/32.png) [@gokcin](https://forum.cursor.com/u/gokcin)\
**Post date:** [September 18, 2024, 4:10pm UTC](https://forum.cursor.com/t/ai-git-commit-messages/1027/25 "2024-09-18T16:10:29Z")

</div>

haha nice. how was your experience with the logical splits in commits that your prompt generates?

Yes, until the staged files context is implemented in cursor, it is not always possible to use this method 😕

---

<div class="post-metadata">

**Author:** ![jpshack-at-palomar](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/jpshack-at-palomar/32/5011_2.png) [@jpshack-at-palomar](https://forum.cursor.com/u/jpshack-at-palomar)\
**Post date:** [September 19, 2024, 4:07am UTC](https://forum.cursor.com/t/ai-git-commit-messages/1027/26 "2024-09-19T04:07:05Z")

</div>

This looks similar to my workflow. I tend to stage my files regularly and then look at `diff --staged`. Really wish cursor would have an option for that as I often find myself doing `diff --staged > diff.txt` and then using @diff.txt to discuss the changes.

BTW I do this for quite a bit more than just commit comments. I have found that when working with Cursor or other ai coding tools it is super helpful to produce design docs that are designed to provide context for the ai. I use cursor to help me write the docs–often referring to previous commits for context–and then commit them to my repo and use them as the PR context. This allows the LLM prompts to get way more done correctly with fewer unplanned passes.

---

<div class="post-metadata">

**Author:** ![blackjak231](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/blackjak231/32/5318_2.png) [@blackjak231](https://forum.cursor.com/u/blackjak231)\
**Post date:** [September 19, 2024, 3:43pm UTC](https://forum.cursor.com/t/ai-git-commit-messages/1027/27 "2024-09-19T15:43:02Z")

</div>

Honestly it works great 99% of the time (appart from the missing staged files context of course).

What could be improved is the prioritization of context. It will sometimes assign a “chore” type with a simple chore task (which is good) but then in the description will include “Created NewComponent in layout” which should be a “feat” commit on it’s own.

Here is what I have added at the end of my prompt template :

````auto
You should create different commits if there are multiple changes. Each output should be a valid git commit command. Each output should be a separate executable command. Each output should group changes closely related to each other into a single commit.

Output format (one per commit):

```bash
git add [file1] [file2] ...

git commit -m "<type>[optional scope in lowercase]: <description>

[optional detailed body description]

[optional footer(s)]
"
```_

````

_FYI: the “\_” at the end can be removed, it’s only for the quotes to show up in the code snippet 🙂_

---

<div class="post-metadata">

**Author:** ![bartomolina](https://avatars.discourse-cdn.com/v4/letter/b/e9bcb4/32.png) [@bartomolina](https://forum.cursor.com/u/bartomolina)\
**Post date:** [September 23, 2024, 3:54pm UTC](https://forum.cursor.com/t/ai-git-commit-messages/1027/28 "2024-09-23T15:54:11Z")

</div>

Have you tried any other extensions for this? I’m using GitLens with Gemini and seems ok:

> **[AI-Generated Commit Messages (Experimental) ✨](https://medium.com/@raihannismara/ai-generated-commit-messages-experimental-99a7435f07df)**
>
> Commit messages can be automatically generated using an AI Provider.

---

<div class="post-metadata">

**Author:** ![YuTengjing](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/yutengjing/32/3704_2.png) [@YuTengjing](https://forum.cursor.com/u/YuTengjing)\
**Post date:** [November 25, 2024, 4:42pm UTC](https://forum.cursor.com/t/ai-git-commit-messages/1027/29 "2024-11-25T16:42:36Z")

</div>

windsurf even support suggestion in commit message box

 ![image](https://us1.discourse-cdn.com/cursor1/original/2X/2/20eb55c40dd469bca96836a1414097786343b0c1.png)

@truell20 @shaoruu @ericzakariasson @danperks

---

<div class="post-metadata">

**Author:** ![berrouanmohammed](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/berrouanmohammed/32/13188_2.png) [@berrouanmohammed](https://forum.cursor.com/u/berrouanmohammed)\
**Post date:** [November 26, 2024, 9:41am UTC](https://forum.cursor.com/t/ai-git-commit-messages/1027/30 "2024-11-26T09:41:38Z")

</div>

Yes we need this feature

---

<div class="post-metadata">

**Author:** ![jkryanchou](https://avatars.discourse-cdn.com/v4/letter/j/ea666f/32.png) [@jkryanchou](https://forum.cursor.com/u/jkryanchou)\
**Post date:** [June 19, 2025, 3:11pm UTC](https://forum.cursor.com/t/ai-git-commit-messages/1027/31 "2025-06-19T15:11:28Z")

</div>

We just need a command could do this work git diff --staged and chat with it in Cmd + L (Chat Windows)

---

<div class="post-metadata">

**Author:** ![gustavs](https://avatars.discourse-cdn.com/v4/letter/g/f04885/32.png) [@gustavs](https://forum.cursor.com/u/gustavs)\
**Post date:** [March 10, 2026, 8:13pm UTC](https://forum.cursor.com/t/ai-git-commit-messages/1027/33 "2026-03-10T20:13:40Z")

</div>

I added instructions in the AGENTS.md to use conventional commits. Then I simply type “commit” in the promt. DONE 🙂

[Previous page](https://forum.cursor.com/t/ai-git-commit-messages/1027.md?page=1)
