git-commit

📁 xdanger/skills 📅 10 days ago
3
总安装量
2
周安装量
#61295
全站排名
安装命令
npx skills add https://github.com/xdanger/skills --skill git-commit

Agent 安装分布

mcpjam 2
antigravity 2
replit 2
junie 2
windsurf 2
zencoder 2

Skill 文档

Git Commit with Gitmoji + Conventional Commits

Commit Format

<Gitmoji> <type>(<scope>)[!]: <subject>

[optional body]

[optional footer(s)]

Example

✨ feat(auth): add OAuth2 login flow

- :sparkles: implement `GoogleAuthProvider` with PKCE
- :lock: add CSRF token validation

Closes #42

Commit Types

Gitmoji Type Purpose
✨ feat New feature
🐛 fix Bug fix
📝 docs Documentation only
💄 style Formatting/style (no logic)
♻️ refactor Code refactor (no feature/fix)
⚡️ perf Performance improvement
✅ test Add/update tests
🏗️ build Build system/dependencies
👷 ci CI/config changes
🔧 chore Maintenance/misc
⏪️ revert Revert commit

Additional Gitmoji (use with closest type)

Gitmoji Meaning Type
🔒️ Security fix fix
🚀 Deploy chore
🎨 Improve structure/format refactor
🔥 Remove code/files chore
🚑️ Critical hotfix fix
➕ Add dependency build
➖ Remove dependency build
🔧 Add/update config chore
🗃️ Database changes feat
📦️ Update compiled/packages build
🚚 Move/rename resources chore
♿️ Accessibility feat
🌐 Internationalization feat
🏷️ Add/update types feat

Subject Line Rules

  • Imperative mood, present tense: “add” not “added”
  • Lowercase, no period at end
  • Max 50 characters
  • Wrap code references in backticks
  • Focus on WHY, not WHAT

Breaking Changes

♻️ refactor(api)!: change response envelope format

BREAKING CHANGE: `data` key renamed to `result` in all API responses

Body Format

Use Gitmoji shortcodes (:emoji:) as bullet prefixes in the body to describe individual changes:

- :sparkles: add new endpoint
- :bug: fix null pointer in handler
- :recycle: extract shared validation logic

Workflow

1. Analyze changes

# Check what's staged vs unstaged
git status --porcelain

# View staged diff (preferred)
git diff --staged

# View unstaged diff if nothing staged
git diff

2. Stage files if needed

# Stage specific files (preferred over git add -A)
git add path/to/file1 path/to/file2

# Stage by pattern
git add src/components/*

Never stage secrets (.env, credentials, private keys).

3. Determine commit attributes

From the diff, determine:

  • Gitmoji + Type: What kind of change?
  • Scope: What module/area? (optional but preferred)
  • Breaking: Does it break existing API/behavior?
  • Subject: One-line summary focusing on WHY

4. Commit

# Single line
git commit -m "✨ feat(auth): add OAuth2 login flow"

# Multi-line with body
git commit -m "$(cat <<'EOF'
✨ feat(auth): add OAuth2 login flow

- :sparkles: implement `GoogleAuthProvider` with PKCE
- :lock: add CSRF token validation

Closes #42
EOF
)"

Best Practices

  • One logical change per commit
  • Reference issues: Closes #123, Refs #456
  • Co-author: append Co-Authored-By: footer when applicable

Git Safety

  • NEVER update git config
  • NEVER run destructive commands (–force, hard reset) without explicit request
  • NEVER skip hooks (–no-verify) unless user asks
  • NEVER force push to main/master
  • If commit fails due to hooks, fix and create NEW commit (don’t amend)