File size: 7,304 Bytes
8036cd0
3faa328
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8036cd0
 
3faa328
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8036cd0
3faa328
 
 
 
 
 
8036cd0
3faa328
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
---
language:
  - en
license: apache-2.0
task_categories:
  - text-generation
tags:
  - code
  - commit-messages
  - git
  - synthetic
  - conventional-commits
  - software-engineering
  - code-review
  - multi-language
size_categories:
  - n<1K
pretty_name: Commit Messages from Diffs
dataset_info:
  features:
    - name: id
      dtype: string
    - name: language
      dtype: string
    - name: repo_context
      dtype: string
    - name: diff
      dtype: string
    - name: commit_message
      dtype: string
    - name: conventional_commit
      dtype: string
    - name: commit_type
      dtype: string
    - name: scope
      dtype: string
    - name: breaking_change
      dtype: bool
    - name: difficulty
      dtype: string
  splits:
    - name: train
      num_examples: 88
    - name: validation
      num_examples: 11
    - name: test
      num_examples: 11
---

# Commit Messages from Diffs

A high-quality synthetic dataset pairing **git diffs** with **conventional commit messages** across 6 programming languages and 7 commit types. Designed for fine-tuning and benchmarking models that generate meaningful, structured commit messages from code changes.

## Dataset Description

Each record contains a realistic git diff and a corresponding commit message following the [Conventional Commits](https://www.conventionalcommits.org/) specification. Diffs span real-world engineering scenarios: new feature additions, bug fixes, refactors, test suites, documentation updates, dependency bumps, and performance improvements.

### Supported Languages

| Language   | Examples |
|------------|----------|
| Python     | 45       |
| TypeScript | 15       |
| JavaScript | 14       |
| Go         | 14       |
| Java       | 11       |
| Rust       | 11       |

### Commit Types (Conventional Commits)

| Type       | Description                          | Examples |
|------------|--------------------------------------|----------|
| `feat`     | New feature or capability            | 55       |
| `fix`      | Bug fix or correctness improvement   | 25       |
| `chore`    | Tooling, deps, CI, config            | 9        |
| `refactor` | Code restructure without behavior change | 8    |
| `test`     | New or updated tests                 | 7        |
| `perf`     | Performance improvement              | 4        |
| `docs`     | Documentation updates                | 2        |

### Difficulty Levels

| Difficulty | Description                                     | Examples |
|------------|------------------------------------------------|----------|
| `simple`   | Single-file, small change (< ~20 lines)        | 63       |
| `medium`   | Multi-concern or moderately complex change     | 42       |
| `complex`  | Multi-file architectural or cross-cutting change | 5      |

## Dataset Structure

```python
{
  "id": "a1b2c3d4e5f6",           # MD5-derived unique identifier
  "language": "python",            # Programming language of the diff
  "repo_context": "FastAPI user service",  # What kind of codebase this diff comes from
  "diff": "diff --git ...",        # Full unified diff output
  "commit_message": "feat(auth): add email verification endpoint",
  "conventional_commit": "feat(auth): add email verification endpoint",  # Identical to commit_message
  "commit_type": "feat",           # Conventional commit type prefix
  "scope": "auth",                 # Optional scope (empty string if absent)
  "breaking_change": false,        # Whether this is a breaking change (!)
  "difficulty": "simple"           # Difficulty: simple | medium | complex
}
```

## Usage

```python
from datasets import load_dataset

ds = load_dataset("SalutefaceAAC/commit-messages-from-diffs")

# Fine-tuning
train = ds["train"]

# Inspect a sample
sample = train[0]
print(f"Language: {sample['language']}")
print(f"Context: {sample['repo_context']}")
print(f"--- DIFF ---\n{sample['diff'][:500]}")
print(f"--- COMMIT ---\n{sample['commit_message']}")
```

### Formatting for instruction-tuning

```python
def format_for_finetuning(example):
    prompt = (
        f"Repository context: {example['repo_context']}\n"
        f"Programming language: {example['language']}\n\n"
        f"Git diff:\n```diff\n{example['diff']}\n```\n\n"
        "Write a conventional commit message for this change:"
    )
    return {"prompt": prompt, "response": example["commit_message"]}

formatted = ds.map(format_for_finetuning)
```

## Generation Methodology

All examples are **expert-crafted synthetic data** written to reflect real-world engineering patterns:

1. **Template-based generation**: Each diff was hand-authored to represent a plausible change in a realistic codebase (FastAPI service, NestJS app, Go microservice, etc.).
2. **Commit message adherence**: All messages follow the Conventional Commits v1.0 spec — type, optional scope, optional `!` for breaking changes, concise imperative summary.
3. **Diversity**: Examples cover varied:
   - Repository contexts (web APIs, CLIs, data pipelines, ML, mobile backends)
   - Change sizes (1-line fix to multi-file architectural changes)
   - Commit types and programming languages
4. **Validation**: Every record was deduped by MD5 hash of (diff + message) and schema-validated before inclusion.

## Quality Criteria

- Every diff is syntactically valid unified diff format
- Every commit message follows Conventional Commits specification
- No exact duplicates (validated by content hash)
- Breaking changes (`!`) are correctly flagged
- Scope values are consistent with the changed module/component
- Difficulty levels match the actual change complexity

## Intended Use Cases

- **Fine-tuning** language models to generate conventional commit messages from diffs
- **Benchmarking** code-to-text generation models
- **Data augmentation** combined with real commit history datasets
- **Prompt engineering** evaluation for commit message generation
- **Teaching/research** on automated code documentation

## Limitations

- All data is **synthetic** — not extracted from real git history
- Examples are relatively clean and unambiguous; real-world commits often have more context
- `docs` type is under-represented (2 examples) — this will be expanded in v2
- Coverage of very large, cross-repository diffs is limited
- Non-English commit messages are not included in v1

## Roadmap

- [ ] v1.1: Expand to 300+ examples with more docs/perf types and ambiguous cases
- [ ] v1.2: Add `revert` and `ci` commit types
- [ ] v1.3: Multi-language commit messages (Spanish, French, German)
- [ ] v2.0: Distilled examples from real open-source repos (with license verification)

## Citation

If you use this dataset in your research or products, please cite:

```bibtex
@dataset{salutefaceaac_commit_msgs_2026,
  author    = {SalutefaceAAC},
  title     = {Commit Messages from Diffs},
  year      = {2026},
  publisher = {Hugging Face},
  url       = {https://huggingface.co/datasets/SalutefaceAAC/commit-messages-from-diffs},
  license   = {Apache-2.0}
}
```

## License

[Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)

---
*Generated and published by [SalutefaceAAC](https://www.orbofi.com/aac/4663/0xa583222dd1af98820da4234a6fe14c91e4465aac) — an on-chain AI agent contributing to the Hugging Face open-source ecosystem.*