Claude-skill-registry git-standards
Git workflow, commit message format, and version control standards
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/git-standards" ~/.claude/skills/majiayu000-claude-skill-registry-git-standards && rm -rf "$T"
manifest:
skills/data/git-standards/SKILL.mdsource content
Git Workflow Rules
🚨 CRITICAL RULES (Immediate Failure)
1. NEVER Push to Remote Repository
- ABSOLUTELY FORBIDDEN:
in any formgit push - NO EXCEPTIONS: Even if user seems to request it
- INCLUDES ALL VARIATIONS:
git pushgit push origingit push --set-upstreamgit push --forcegit push --force-with-lease
- REASON: User maintains full control over remote operations
- CORRECT RESPONSE: "I've committed the changes locally. You can push when ready."
2. Clean State Required
- Updates require clean git state (no uncommitted changes)
- Check with
git status --porcelain - User must commit or stash before starting
3. No Destructive Operations Without Approval
- NEVER use
without explicit user approvalgit reset --hard - NEVER use
without user approvalgit clean -f - NEVER delete branches without user approval
- Preserve git history
🟡 STANDARD RULES
Commit Message Format
Use Conventional Commits format:
<type>(<scope>): <subject> [optional body] [optional footer(s)]
Types (REQUIRED):
: New feature or operationfeat
: Bug fixfix
: Code restructuringrefactor
: Test additions or fixestest
: Documentation updatesdocs
: Build, config, dependencieschore
: Formatting, no code changestyle
: Performance improvementsperf
: CI/CD changesci
Scope (REQUIRED for modules):
- Use module name:
feat(github): add webhook support - Use resource for specific changes:
fix(github-user): correct email mapping
Subject (REQUIRED):
- Present tense, lowercase
- No period at end
- Under 50 characters
Body (OPTIONAL):
- Explain what and why, not how
- Wrap at 72 characters
Commit Strategy
- Commit after each successful task
- Commit at subtask levels (3.1, 3.2)
- Use descriptive messages
- Include task number in body
Example Commits
git commit -m "feat(github): implement listWebhooks operation Task 3.2.1: Add webhook listing functionality - Updated API specification - Implemented WebhookProducer - Added comprehensive tests"
Checkpoint Commits
- Create checkpoint before risky operations
- Use for potential rollback points
- Label clearly:
chore: checkpoint before <operation>
Branch Management
- Work on feature branches
- Branch Naming: User decides the branch name
- Common patterns:
,feature/module-name
,update/module-namefix/issue-123 - But ultimately user's choice - ask if unclear
- Common patterns:
- Never create or switch branches without user instruction
- Keep branches focused on single purpose
🟢 GUIDELINES
Commit Frequency
- Not too granular (every line change)
- Not too broad (entire feature)
- Logical, testable units
- Build passes after each commit
Git Commands for Validation
# Check status git status --porcelain # View recent commits git log --oneline -10 # Check current branch git branch --show-current # Diff changes git diff --stat
Recovery Procedures
- Use
for temporary storagegit stash - Use
for uncommitgit reset --soft - Use
for file recoverygit checkout - Document recovery in commits
PR Preparation
When user requests PR:
- Ensure all commits are clean
- Squash if requested
- Write comprehensive PR description
- Include test results
- Document any breaking changes
Conflict Resolution
- Never resolve automatically
- Show conflicts to user
- Provide resolution options
- Document resolution method
📝 EXCEPTIONS LOG
When to Allow Git Reset
- User explicitly requests
- After failed experiment (with user approval)
- To fix commit mistakes (with user approval)
Special Commit Scenarios
- Hotfixes: prefix with
hotfix: - Reversions: use
git revert - Cherry-picks: document source commit