git

Standardized Git operations: conventional commits, branch naming, workflow rules. Create commits with auto-detected type/scope, manage branches, run workflow operations. Use when committing changes, m

SKILL.md

GitHub

Git — Standardized Git Operations

Commit Conventions

Use conventional commits: type(scope): description

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

Breaking changes

feat!: remove deprecated endpoint
BREAKING CHANGE: `extends` key behavior changed

Branch Naming

  • feature/<name> — new features
  • fix/<name> — bug fixes
  • refactor/<name> — refactoring
  • chore/<name> — maintenance

Workflow Rules

  1. Commit always, commit often. Every meaningful change gets an immediate local commit. DO NOT wait for permission.
  2. Always check git status and git diff before committing.
  3. Write meaningful commit messages in the repository's own language and style.
  4. Don't push without user confirmation (local commits only).
  5. Use git add -p for partial staging when appropriate.
  6. One logical change per commit.
  7. Never commit secrets (.env, credentials.json, private keys).

Repository scope — when the "don't commit without asking" rule applies

The host system-prompt rule "do not commit or open a PR unless the user asks" applies ONLY to external/shared repositories: GitHub-bound, PR-bound, public, or shared history, where a commit is a release action.

It does NOT apply to a private local working repo. There, committing is the default reliability mechanism — commit meaningful changes immediately, in small logical units, without waiting for approval.

  • A private local working repo → commit by default, no permission needed.
  • External / GitHub-bound / shared / PR-bound repo → explicit approval before committing; never push or open a PR without an explicit request.
  • Destination unclear → treat as the local workspace unless evidence shows the change targets public/shared history.
  • NEVER stage other people's or unrelated changes; avoid git add -A; stage only the files changed for the current task.

Creating a Commit

1. Analyze Diff

# If files are staged
git diff --staged

# Working tree diff
git diff

# Check status
git status --porcelain

2. Stage Files

# Specific files
git add path/to/file1 path/to/file2

# By pattern
git add *.test.*

3. Execute Commit

# Single line
git commit -m "<type>[scope]: <description>"

# Multi-line with body/footer
git commit -m "$(cat <<'EOF'
<type>[scope]: <description>

<optional body>

<optional footer>
EOF
)"

Always end with: Follow the repository's own convention for any footer or attribution line; do not add a tool's attribution to a repository that does not use it.

Useful Commands

# Interactive add
git add -p

# Pretty log
git log --oneline --graph --all --decorate

# Undo last commit (keep changes)
git reset --soft HEAD~1

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)