SalutefaceAAC's picture
fix(card): correct task_categories to text-generation
42a792d verified
|
Raw History Blame Contribute Delete
7.3 kB
---
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.*