|
1 | | -# Git Commits & Pull Requests |
| 1 | +# Git |
2 | 2 |
|
3 | 3 | ## Commits |
| 4 | + |
4 | 5 | - Never commit, amend, or push without explicit permission |
5 | | -- Don't commit intermediate states — wait until the full implementation is complete, reviewed, and explicitly approved before committing. If the user corrects direction mid-implementation, incorporate the correction before any commit |
6 | | -- Always create a new branch from `main` before starting any new work — never commit directly to `main` or reuse an existing feature branch for unrelated changes |
7 | | -- Use conventional commit format: `fix:`, `feat:`, `refactor:`, `docs:`, `test:`, `chore:` |
8 | | -- Keep commits atomic - one logical change per commit |
9 | | -- Commit message body should be concise (1-2 sentences max) |
10 | | -- Merge for simple syncs, rebase when branches have diverged significantly |
11 | | -- When committing to an external/third-party repo, follow that repo's own conventions for versioning, changelog, and CI |
12 | | -- Pre-commit: Run `uv run prek` before committing — fix any issues before creating the commit |
13 | | -- Pre-push: Run `uv run prek run --from-ref origin/<base>` to check all changed files against the PR base — this matches CI behavior and catches issues that per-commit prek misses. To detect the base branch: `gh pr view --json baseRefName -q .baseRefName 2>/dev/null || echo main` |
| 6 | +- Don't commit intermediate states — wait until the full implementation is complete and approved |
| 7 | +- Always create a new branch from `main` — never commit directly to `main` |
| 8 | +- Conventional format: `fix:`, `feat:`, `refactor:`, `docs:`, `test:`, `chore:` |
| 9 | +- First line: imperative verb + what changed, under 72 characters |
| 10 | +- Body for *why*, not *what* — the diff shows what changed |
| 11 | +- One purpose per commit: a bug fix, a new function, a refactor — not all three |
| 12 | +- A commit that adds a function also adds its tests and exports — that's one logical change |
| 13 | + |
| 14 | +## Sizing |
| 15 | + |
| 16 | +- Too small: renaming a variable in one commit, updating its references in another |
| 17 | +- Right size: adding a function with its tests, `__init__` export, and usage update |
| 18 | +- Too large: implementing an entire subsystem in one commit |
| 19 | + |
| 20 | +## Pre-commit / Pre-push |
| 21 | + |
| 22 | +- Pre-commit: Run `uv run prek` before committing |
| 23 | +- Pre-push: Run `uv run prek run --from-ref origin/<base>` to check all changed files against the PR base |
14 | 24 |
|
15 | 25 | ## Pull Requests |
16 | | -- PR titles should use conventional format |
17 | | -- Keep the PR body short and straight to the point |
| 26 | + |
| 27 | +- PR titles use conventional format |
| 28 | +- Keep the PR body short and to the point |
18 | 29 | - If related to a Linear issue, include `CF-#` in the body |
19 | | -- Branch naming: `cf-#-title` (lowercase, hyphenated), no other prefixes/suffixes |
| 30 | +- Branch naming: `cf-#-title` (lowercase, hyphenated) |
| 31 | + |
| 32 | +## Branch Hygiene |
| 33 | + |
| 34 | +- Delete feature branches locally after merging (`git branch -d <branch>`) |
| 35 | +- Use `/clean_gone` to prune local branches whose remote tracking branch has been deleted |
0 commit comments