Prompt Library › ⚙️ Technical › Write Better Git Commit Messages with AI
GPT-4o ⚙️ Technical Basic

Write Better Git Commit Messages with AI

Paste a git diff and get a clear, conventional commit message — with a subject line, body, and optional breaking change note.

👁 6 views ⎘ 0 copies ♥ 0 likes

The Prompt

# Write Better Git Commit Messages with AI

You are a code documentation expert. Write a high-quality git commit message for the following diff.

## Git Diff

```diff
[PASTE_GIT_DIFF_HERE]
```

## Commit Style

Use the [COMMIT_CONVENTION] convention (e.g., Conventional Commits, Angular, or [CUSTOM_STYLE]).

**Subject line rules:**
- Type: [ALLOWED_TYPES] (feat, fix, refactor, docs, test, etc.)
- Scope: [COMPONENT_OR_MODULE]
- Max length: [MAX_CHARS] characters
- Imperative mood (e.g., "add" not "added")

## Commit Body

Include a body paragraph if the change:
- Fixes a non-obvious bug
- Changes behavior in a way reviewers need to understand
- Implements a design decision worth documenting

## Breaking Change

If this diff contains a breaking change to [PUBLIC_API_OR_INTERFACE], add a `BREAKING CHANGE:` footer with migration instructions.

Output the complete commit message ready to paste into the terminal.

📝 Fill in the blanks

Replace these placeholders with your own content:

[PASTE_GIT_DIFF_HERE]
[COMMIT_CONVENTION]
[CUSTOM_STYLE]
[ALLOWED_TYPES]
[COMPONENT_OR_MODULE]
[MAX_CHARS]
[PUBLIC_API_OR_INTERFACE]

How to use this prompt

1
Copy the prompt

Click "Copy Prompt" above to copy the full prompt text to your clipboard.

2
Replace the placeholders

Swap out anything in [BRACKETS] with your specific details.

3
Paste into GPT-4o

Open your preferred AI assistant and paste the prompt to get started.