| --- |
| language: |
| - en |
| tags: |
| - code |
| - git |
| - commit-messages |
| - typescript |
| - conventional-commits |
| - fine-tuning |
| pretty_name: Git Diff → Conventional Commit Messages (TypeScript) |
| size_categories: |
| - 10K<n<100K |
| task_categories: |
| - text-generation |
| - summarization |
| --- |
| |
| # Git Diff → Conventional Commit Messages |
|
|
| A dataset of 12,433 `(git diff, commit message)` pairs scraped from real open-source TypeScript repositories, filtered for quality and formatted for fine-tuning small language models to generate [Conventional Commits](https://www.conventionalcommits.org/). |
|
|
| Built as part of a project to fine-tune a local LLM to write commit messages as a `prepare-commit-msg` git hook. Full write-up: [eliotbas.com/projects/commits-fine-tuning](https://eliotbas.com/projects/commits-fine-tuning/) |
|
|
| ## Dataset details |
|
|
| ### Source repositories |
|
|
| 13 open-source TypeScript repositories selected for commit discipline and diversity: |
|
|
| - **Libraries**: Vite, Vitest, Vue.js core, Angular, tRPC, TanStack Query |
| - **Apps/platforms**: Supabase, Nuxt, Twenty, Prisma, TypeORM |
| - **Tooling**: typescript-eslint, commitlint |
| - **Workflow-specific**: Botpress OSS (to match the author's internship codebase) |
|
|
|
|
| ### Format |
|
|
| JSONL, chat format. Each example has a `messages` field with two turns: |
|
|
| ```json |
| { |
| "messages": [ |
| { |
| "role": "user", |
| "content": "diff --git a/src/index.ts b/src/index.ts\n..." |
| }, |
| { |
| "role": "assistant", |
| "content": "feat(core): add retry logic for failed requests" |
| } |
| ], |
| "meta": { |
| "repo": "vitejs/vite", |
| "hash": "496a63ad5af3b9e5a7bba5477057f1e61a267a70" |
| } |
| } |
| ``` |
|
|
| ## Filtering and quality criteria |
|
|
| Not every commit was kept. The main filters applied: |
|
|
| - **Conventional Commits enforcement** — message must match `type(scope)?: description` format |
| - **Trailing ref stripping** — `(#1234)` references removed; not inferable from the diff and would be learned as hallucination fodder |
| - **Generated-file exclusion** — each commit must touch at least one non-generated file (lockfiles, minified JS, `dist/`, snapshots excluded) |
| - **Per-repo cap** — prevents large repos (e.g. Angular) from dominating the distribution |
| - **Length filter** — too small and too big commits are filtered |
|
|
| ## Commit type distribution |
|
|
| | Type | Share | |
| |------|-------| |
| | fix | ~30% | |
| | chore | ~18% | |
| | docs | ~14% | |
| | feat | ~13% | |
| | test | ~8% | |
| | refactor | ~7% | |
| | ci / build / perf / style | ~10% combined | |
|
|
| ## Key statistics |
|
|
| | Metric | Value | |
| |--------|-------| |
| | Commit message length (p50) | 54 chars | |
| | Commit message length (p95) | 91 chars | |
| | Diff length (p50) | 2,024 chars | |
| | Diff length (p95) | 7,827 chars | |
|
|
| ## Intended use |
|
|
| Designed for LoRA fine-tuning of small code language models (0.5B–3B parameters) on the task of generating a single Conventional Commit message from a `git diff --staged` output. |
|
|
| Models fine-tuned on this dataset were evaluated in the accompanying article. Best results with: |
| - Qwen2.5-Coder-0.5B-Instruct |
| - Qwen2.5-Coder-1.5B-Instruct |
| - Qwen2.5-Coder-3B-Instruct |
|
|
| ## Limitations |
|
|
| - **TypeScript-specific**: sourced entirely from TypeScript repos; may not generalize to other languages or mixed codebases |
| - **High-discipline repos only**: all source repos follow Conventional Commits strictly; behavior on messier codebases is untested |
| - **Diff-only context**: the model sees only the diff, not the ticket, PR description, or broader codebase context — the human author always had more information |
|
|
|
|
| ## Related resources |
|
|
| - Article: [eliotbas.com/projects/commits-fine-tuning](https://eliotbas.com/projects/commits-fine-tuning/) |
| - GitHub (scraping scripts, training and evaluation code, git hook): [github.com/Elib27/commits-fine-tune](https://github.com/Elib27/commits-fine-tune) |
| - Fine-tuned models: *(HuggingFace model links)* |