87 lines
2.6 KiB
TypeScript
87 lines
2.6 KiB
TypeScript
export const GIT_MASTER_QUICK_REFERENCE_SECTION = `## Quick Reference
|
|
|
|
### Style Detection Cheat Sheet
|
|
|
|
| If git log shows... | Use this style |
|
|
|---------------------|----------------|
|
|
| \`feat: xxx\`, \`fix: yyy\` | SEMANTIC |
|
|
| \`Add xxx\`, \`Fix yyy\`, \`xxx 추가\` | PLAIN |
|
|
| \`format\`, \`lint\`, \`typo\` | SHORT |
|
|
| Full sentences | SENTENCE |
|
|
| Mix of above | Use MAJORITY (not semantic by default) |
|
|
|
|
### Decision Tree
|
|
|
|
\`\`\`
|
|
Is this on main/master?
|
|
YES -> NEW_COMMITS_ONLY, never rewrite
|
|
NO -> Continue
|
|
|
|
Are all commits local (not pushed)?
|
|
YES -> AGGRESSIVE_REWRITE allowed
|
|
NO -> CAREFUL_REWRITE (warn on force push)
|
|
|
|
Does change complement existing commit?
|
|
YES -> FIXUP to that commit
|
|
NO -> NEW COMMIT
|
|
|
|
Is history messy?
|
|
YES + all local -> Consider RESET_REBUILD
|
|
NO -> Normal flow
|
|
\`\`\`
|
|
|
|
### Anti-Patterns (AUTOMATIC FAILURE)
|
|
|
|
1. **NEVER make one giant commit** - 3+ files MUST be 2+ commits
|
|
2. **NEVER default to semantic style** - detect from git log first
|
|
3. **NEVER separate test from implementation** - same commit always
|
|
4. **NEVER group by file type** - group by feature/module
|
|
5. **NEVER rewrite pushed history** without explicit permission
|
|
6. **NEVER leave working directory dirty** - complete all changes
|
|
7. **NEVER skip JUSTIFICATION** - explain why files are grouped
|
|
8. **NEVER use vague grouping reasons** - "related to X" is NOT valid
|
|
|
|
---
|
|
|
|
## FINAL CHECK BEFORE EXECUTION (BLOCKING)
|
|
|
|
\`\`\`
|
|
STOP AND VERIFY - Do not proceed until ALL boxes checked:
|
|
|
|
[] File count check: N files -> at least ceil(N/3) commits?
|
|
- 3 files -> min 1 commit
|
|
- 5 files -> min 2 commits
|
|
- 10 files -> min 4 commits
|
|
- 20 files -> min 7 commits
|
|
|
|
[] Justification check: For each commit with 3+ files, did I write WHY?
|
|
|
|
[] Directory split check: Different directories -> different commits?
|
|
|
|
[] Test pairing check: Each test with its implementation?
|
|
|
|
[] Dependency order check: Foundations before dependents?
|
|
\`\`\`
|
|
|
|
**HARD STOP CONDITIONS:**
|
|
- Making 1 commit from 3+ files -> **WRONG. SPLIT.**
|
|
- Making 2 commits from 10+ files -> **WRONG. SPLIT MORE.**
|
|
- Can't justify file grouping in one sentence -> **WRONG. SPLIT.**
|
|
- Different directories in same commit (without justification) -> **WRONG. SPLIT.**
|
|
|
|
---
|
|
|
|
### Commit Mode
|
|
- One commit for many files -> SPLIT
|
|
- Default to semantic style -> DETECT first
|
|
|
|
### Rebase Mode
|
|
- Rebase main/master -> NEVER
|
|
- \`--force\` instead of \`--force-with-lease\` -> DANGEROUS
|
|
- Rebase without stashing dirty files -> WILL FAIL
|
|
|
|
### History Search Mode
|
|
- \`-S\` when \`-G\` is appropriate -> Wrong results
|
|
- Blame without \`-C\` on moved code -> Wrong attribution
|
|
- Bisect without proper good/bad boundaries -> Wasted time`
|