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
mainor 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.3. Commit → Issue Reference Strategy
Fixes vs Refs
Single-commit subtask
The subtask fits in one commit → useFixes #N:
Multi-commit subtask → promote to its own issue
When a subtask grows to need multiple commits → promote it to its own issue.Refs, final commit uses Fixes:
4. History Integrity
Don’t Rewrite Pushed History
Rewriting pushed commits in open source breaks contributors’ local copies. Don’t:git push --forceon shared branches- Amend commits already pushed to
main - Rebase branches others are working on
- Clean up with
git rebase -ibefore pushing - Use
git revertto 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:- Leave existing commits as-is — don’t rewrite history
- Promote the subtask to a new issue (
#45) - Future commits reference
#45 - Add a note in
#45description 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
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 ingit 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