Prompt Library 💻 Coding & Dev Create a Git Diff Commit Message
GPT-4o 💻 Coding & Dev Basic

Create a Git Diff Commit Message

Generate a clear, conventional commit message from a git diff — following best practices for semantic versioning and team communication.
👁 8 views ⎘ 0 copies ♥ 0 likes

The Prompt

# Generate a Git Commit Message from Diff

Analyze the following git diff and generate a well-structured commit message following [CONVENTION — e.g., Conventional Commits, Angular commit style, or custom team format].

## Git Diff
```diff
[PASTE_GIT_DIFF_HERE]
```

## Commit Message Requirements

### Format
Follow this structure:
```
<type>(<scope>): <short description>

[optional body]

[optional footer]
```

**Type options:** feat | fix | docs | style | refactor | test | chore | perf | ci | build

### Guidelines
- **Short description:** Max 72 characters, imperative mood ("add" not "added"), no period at end
- **Scope:** The component or module affected (e.g., auth, api, dashboard, db)
- **Body:** Explain the WHY, not just what changed. Wrap at 72 characters.
- **Footer:** Reference any issue numbers: `Closes #[ISSUE_NUMBER]` or `BREAKING CHANGE: [description]`

## Output
Provide:
1. **Recommended commit message** (formatted correctly)
2. **Alternative commit message** (different type or scope interpretation)
3. **Analysis notes** — explain what the diff does in plain English (2–3 sentences)
4. **Flag**: If the diff is too large for a single commit, suggest how to split it into atomic commits

## Context (optional)
- **Branch name:** [BRANCH_NAME]
- **Related issue/ticket:** [ISSUE_NUMBER]
- **Breaking change?:** [YES/NO]

Be precise and follow the convention strictly.

📝 Fill in the blanks

Replace these placeholders with your own content:

[CONVENTION — e.g., Conventional Commits, Angular commit style, or custom team format]
[PASTE_GIT_DIFF_HERE]
[optional body]
[optional footer]
[ISSUE_NUMBER]
[description]
[BRANCH_NAME]
[YES/NO]

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.