Skip to main content

1. Atomic Commits

One commit = one logical reason to change.

Cross-cutting Changes

A single logical reason may touch multiple files or scopes. This is still one atomic commit — scope the commit to the primary domain.

Rule

Useful Tools

  • git add -p — stage only part of your changes (patch mode)
  • git rebase -i — clean up local commits before pushing
  • Never commit WIP to main or release branches

2. Issue Anatomy

One Issue = One Cohesive Domain

If an issue contains unrelated problems → split into separate issues.

Break Into Subtasks

Related problems within one domain → stay as GitHub checkbox subtasks inside the issue.
Each subtask maps to one or more atomic commits referencing the parent issue.

3. Commit → Issue Reference Strategy

Fixes vs Refs

Single-commit subtask

The subtask fits in one commit → use Fixes #N:

Multi-commit subtask → promote to its own issue

When a subtask grows to need multiple commits → promote it to its own issue.
Intermediate commits on the promoted issue use Refs, final commit uses Fixes:
Check off the promoted subtask in the original issue with a reference:

4. History Integrity

Don’t Rewrite Pushed History

Rewriting pushed commits in open source breaks contributors’ local copies. Don’t:
  • git push --force on shared branches
  • Amend commits already pushed to main
  • Rebase branches others are working on
Do:
  • Clean up with git rebase -i before pushing
  • Use git revert to undo a pushed commit safely

When a Task Evolves After Commits Exist

If a subtask was promoted to a new issue after some commits already referenced the old issue:
  1. Leave existing commits as-is — don’t rewrite history
  2. Promote the subtask to a new issue (#45)
  3. Future commits reference #45
  4. Add a note in #45 description linking the earlier commits:
Rule: Don’t rewrite history. Promote forward, document backward.

5. Merge Strategy — Rebase for Traceability

For open source + traceability: always rebase.

6. Git Log Strategy

Merge Commits — Ignore in Daily Work

Merge commits are navigation markers only — they tell you that a PR merged, not why anything changed.

Useful Aliases

When Merge Commits ARE Useful


7. PR Description

PR descriptions are ephemeral — they live in GitHub’s database, not in Git. They don’t appear in git log, survive repo migrations, or exist for contributors without GitHub access.

Commit vs PR — Roles

Write commit messages as if the PR never existed — because for git log, it effectively doesn’t.

What Belongs in a PR Description

  • Summary of what the PR does (for reviewers)
  • Screenshots / recordings for UI changes
  • Testing instructions for reviewers
  • Links to related issues or discussions
  • Anything too contextual for a commit body that only reviewers need

8. GitHub Issue Labels

Issue labels describe work before and during development. Commit types describe the result.

Type Labels

Size Labels

Status Labels

Mapping: Issue Labels → Commit Types


Summary