---
name: git-commit-conventions
description: Make focused commits with short messages and the user's git authorship. Use before every commit or push, including /commit.
title: git-commit-conventions
canonical_url: https://skilld.dev/gh/zazencodes/skills/git-commit-conventions
last_updated: 2026-11-14T05:01:28.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [agents/openai.yaml](https://skilld.dev/api/skills-raw/zazencodes/skills/git-commit-conventions/agents/openai.yaml).
>
> If the user asked to install this Skill, run `npx skilld install zazencodes/skills/git-commit-conventions`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/git-commit-conventions`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/zazencodes/skills/git-commit-conventions) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/git-commit-conventions`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/git-commit-conventions --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/git-commit-conventions --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Git Commit Conventions

Follow these conventions on every commit.

- Commit authorship should follow the user's system git config only; no co-author trailers.
- Commit messages should be very simple: one short line per distinct batch of changes.

## Working conventions

- Read `git diff` and check for untracked files before deciding on commits.
- One commit per distinct batch of changes. Only group files together when they
  are closely related; otherwise commit them separately.
- Match the message style of the recent commits in this repo.
- Never add AI attribution — no `Co-Authored-By`, no "Generated with" footer.
- Attempt simple fixes yourself; ask for guidance on merge conflicts or anything
  that risks losing work.

## Splitting a mixed working tree

Batches are defined by *intent*, not by file. Two batches routinely touch the same
file — a feature and a follow-up fix to it, a refactor and a behaviour change. That
they interleave inside a file is the normal case, not a reason to give up and make
one commit.

Default to splitting. Do it without being asked, and do not ask permission first:
splitting is expected, and the work below is mechanical and reversible.

- Separate work the user asked for in separate turns into separate commits. If they
  said "build X", then later "now fix Y", that is two batches even if Y edits the
  files X created.
- Do not merge batches because the split "would be a rebase, not staging" or because
  a file was rewritten wholesale. Neither is a reason to combine them.
- `git add -p` needs a TTY and is unavailable. Use the reconstruct method instead:
  1. Copy the final version of every file containing more than one batch somewhere
     outside the repo.
  2. `git reset --soft HEAD~1` if already committed, otherwise just start here.
  3. Edit those files back to the state of the *first* batch alone, then commit it.
  4. Restore the saved final versions, then commit the second batch.
  Repeat step 3–4 for a third batch and beyond.
- Order commits so each one stands alone: the earlier commit must build and pass
  tests without the later one. Verify it — `git stash -u`, check out the earlier
  commit, run the test suite, then return. An earlier commit that only works once
  the next lands is a broken split, not a split.
- Stage explicit paths. `git add -A` silently sweeps in unrelated untracked files;
  check `git show --stat` after committing and amend if something snuck in.
- When done, confirm the split preserved the work: `git diff <original-sha> HEAD`
  should be empty, or show only changes you can name and justify.

If a split genuinely cannot be made to work, say so and explain what blocks it,
rather than committing everything together and mentioning it afterwards.
