I’m a frequent user of the generate commit message feature. It is useful to have it automatically generate the message and then I can tweak it from there.
The Issue
While the automatic generation is excellent, there are times when the generated message, though accurate, might not fully capture the intent behind a change. The AI does a great job of summarizing the “what” of the changes, but sometimes misses the “why” or the broader context that I have in my head. This can lead to commit messages that are slightly off or require alot manual editing to add that crucial context.
Proposed Feature
I would like to suggest an enhancement to the generate commit message feature that allows users to provide an optional input description to guide the AI.
Here’s how I envision it working:
A user stages their changes as they normally would.
In the commit message box, the user can optionally type a brief description or a few keywords that describe the high-level goal of the commit.
The user then triggers the generate commit message command.
Cursor AI takes the user’s input description into account, along with the diff of the staged files, and the cursor rules for commit messages to generate a more context-aware and accurate commit message.
Clarification on generate commit message:
I did some initial testing by typing a message and then running the generation to see if this functionality already exists in some form. It wasn’t immediately clear if my input was being considered. If this capability is already present, I would appreciate some clarification on this.
Currently, the feature already looks at your commit diff and the format of your last commit messages, but totally get the desire to have some input on what’s written here.
Do you use this prompt in the chat and the agent can handle this right?
Does the agent automatically create the detailedCommitMessageTemporaryFile.txt file or is this something you have in the root of your repo that is in the .gitignore
Either way, thanks for the suggestion! I’ll try to experiment with this today, to see how it is.
Detailed example of the requested feature
@danperks, I thought it would help to provide images of what I think this feature would look like.
I would say the best commit message would be the second one. While the one generated with generate_commit_message did describe the changes in the files, it missed the overall intent.
Yes, I just paste that into the chat. The “-F” specification was necessary because multiline commit messages did not work in Cursor. I don’t know if that’s still the case.