Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.americ.io.vn/llms.txt

Use this file to discover all available pages before exploring further.

1. Atomic Commits

One commit = one logical reason to change.
❌ fix login bug and update README and bump lodash version

✅ 🩹fix(auth): resolve null pointer on failed login
✅ 📝docs(readme): update installation steps
✅ 🔨chore(deps): bump lodash to 4.17.21

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.
🩹fix(auth): prevent null pointer on login failure

- middleware/auth.js   → add null guard on token parse
- config/auth.js       → set default token expiry fallback
- services/auth.js     → handle missing user gracefully

Rule

CaseAction
Same logical reason, many filesOne commit, primary scope
Independent value on its ownSeparate commit

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.
❌ 🐛bug #42 — Auth broken + dashboard slow + docs outdated
   (unrelated concerns → should be 3 separate issues)

✅ 🐛bug #42  — Auth is broken
✅ 🍄improvement #43 — Dashboard performance
✅ 🗃documentation #44 — Outdated docs

Break Into Subtasks

Related problems within one domain → stay as GitHub checkbox subtasks inside the issue.
🐛bug #42 — Auth is broken  [size: M]
  ☐ Prevent null pointer on login failure
  ☐ Fix token refresh race condition
Each subtask maps to one or more atomic commits referencing the parent issue.

3. Commit → Issue Reference Strategy

Fixes vs Refs

FooterWhen to Use
Fixes #NLast (or only) commit that resolves the issue — closes it automatically on merge
Refs #NIntermediate commits that are part of the issue but don’t close it yet

Single-commit subtask

The subtask fits in one commit → use Fixes #N:
🩹fix(auth): prevent null pointer on login failure

Fixes #42

Multi-commit subtask → promote to its own issue

When a subtask grows to need multiple commits → promote it to its own issue.
🐛bug #42 — Auth is broken
  ☑ Prevent null pointer on login failure    → Fixes #42 (single commit)
  ☐ Fix token refresh race condition         → too big → promoted to #45
Intermediate commits on the promoted issue use Refs, final commit uses Fixes:
🩹fix(auth): extract token validation logic     Refs #45
🩹fix(auth): add mutex lock to refresh call     Refs #45
✅test(auth): cover race condition scenario      Fixes #45
Check off the promoted subtask in the original issue with a reference:
☑ Fix token refresh race condition → promoted to #45

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:
Related commits before this issue was created:
- abc1234 🩹fix(auth): initial token refresh investigation (Refs #42)
Rule: Don’t rewrite history. Promote forward, document backward.

5. Merge Strategy — Rebase for Traceability

StrategyTraceabilityUse When
RebaseFull atomic history on mainOpen source, traceability-first
SquashOne commit per PRSmall PRs with messy WIP commits
Merge commitBranch topology preservedWhen you need visual branch history
For open source + traceability: always rebase.

6. Git Log Strategy

Merge Commits — Ignore in Daily Work

* a1b2c3d  Merge pull request #42 from user/feature   ← skip (navigation marker)
* f3e4d5c  🩹fix(auth): prevent token refresh race     ← real history
* b1c2d3e  ✨feat(auth): add OAuth2 login flow          ← real history
Merge commits are navigation markers only — they tell you that a PR merged, not why anything changed.

Useful Aliases

# Clean log — no merge commits
git log --oneline --no-merges

# Set as permanent alias
git config --global alias.hist "log --oneline --no-merges --graph"

# Use:
git hist

When Merge Commits ARE Useful

ScenarioWhy
git revert a whole featureRevert the merge commit = undo entire PR at once
Tracing when a branch landedgit log --merges shows PR merge timeline

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

LayerPurposeAudience
Each commitPermanent record, git bisect, blameFuture contributors, yourself in 6 months
PR descriptionReview context, screenshots, discussionReviewers right now
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

LabelCovers
🐛bugBroken functionality
✨requestNew functionality
🍄improvementKaizen / polish / performance / DX
🔍testingAdd or fix tests
🏗refactorInternal restructuring
🎨designUI/UX work
🔒securityVulnerabilities / hardening
🔬researchSpikes, POCs
🗃documentationDocumentation
💬discussionProposals / decisions

Size Labels

LabelMeaning
🔹size: SSmall — quick change, low risk
🔶size: MMedium — moderate scope
🔴size: LLarge — significant changes, needs careful review
👺size: XLExtra large — consider breaking it down

Status Labels

LabelMeaning
🤔Need ReproduceBug needs a reproduction case before work begins
🕗TodoAccepted, not yet started
🧑‍💻DoingCurrently in progress
🚽WON'T DORejected or out of scope
📦ReleasedShipped to production

Mapping: Issue Labels → Commit Types

Issue LabelLikely Commit Type
🐛bug🩹fix
✨request✨feat
🍄improvement⚡️perf or ♻️refactor
🔍testing✅test
🏗refactor♻️refactor
🎨design✨feat or ♻️refactor
🔒security🩹fix or ♻️refactor
🗃documentation📝docs

Summary

ConcernDecision
Commit sizeAtomic — one logical reason, may touch many files
Cross-cutting changesOne commit, primary scope
Issue scopeOne cohesive domain — split if unrelated
Subtask sizeSingle commit → stay; multiple commits → promote to own issue
Commit referenceRefs #N for intermediate, Fixes #N for final
History rewritingNever on pushed branches — promote forward, document backward
PR merge strategyRebase (preserves full atomic history)
Merge commitsNavigation markers only — use --no-merges in daily git log
PR descriptionsEphemeral — write commits as if PR never existed