# Git Discipline

> Enforce conventional commits, clean branch strategy, small focused diffs, and PR-ready history. Use before any commit or when preparing work for review. Triggers: "commit this cleanly", "prepare for PR", "fix the git history", "use git-discipline".

- Skill: `cobusgreyling/git-discipline` (Agent Skill)
- Install (CLI): `npx skillmds@latest add cobusgreyling/git-discipline`
- Raw SKILL.md: https://api.skillmd.com/api/skills/cobusgreyling/git-discipline/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: cobusgreyling (https://skillmd.com/u/cobusgreyling)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/cobusgreyling/git-discipline

---


# Git Discipline

Never let agentic speed destroy repository hygiene.

## Mandatory Steps

1. **Stage intentionally** — only the files that belong in this logical change.
2. **Write a Conventional Commit message**:
   - `feat:`, `fix:`, `refactor:`, `docs:`, `test:`, `chore:`, `perf:`
   - Scope when useful: `feat(api): ...`
   - Body that explains *why*, not just what.
3. **Create or update branch** following `feature/`, `fix/`, etc.
4. **Never commit directly to main.**
5. **Rebase or merge cleanly** before opening PR.
6. **PR description** should reference the plan or relevant skills used.

## Agent Behavior

- After edits, offer to run `git diff --staged` and propose a commit.
- If history is messy, propose a rebase plan (never force-push without confirmation).
- When multiple logical changes are staged together, split them.

## Verification
- `git log --oneline -10` should tell a clear story.
- Each commit should be buildable/testable in isolation where practical.

