Commit Commands — Git Workflow Automation

Streamlined Git Workflows

Automates the entire git workflow from staging to PR creation with style-aware commit messages, intelligent branch management, and stale branch cleanup.

3
Commands
0
Agents
5
Files
MD
Language

📦 Git Workflow🔀 Branch Management📝 Style-Aware Commits🧹 Cleanup

📚 What is this & why does it exist?

Commit Commands eliminates the repetitive friction of git workflows. Instead of manually crafting commit messages, pushing, creating branches, and opening PRs, this plugin handles the entire pipeline with three commands. It reads CLAUDE.md and project conventions to generate commit messages that match your team's style — whether that's Conventional Commits, Gitmoji, or a custom format. The /clean_gone command keeps your local repository tidy by pruning branches whose upstream tracking refs are gone.

💡 Real-world analogy

Think of a personal assistant at a shipping dock. You hand them a package (your code changes), and they label it correctly according to the warehouse's system (commit style), load it onto the right truck (push to the right branch), file the paperwork (create the PR), and sweep up the loading bay afterward (clean stale branches). You never touch a label maker or broom — you just say "ship it."

Architecture

flowchart LR
    subgraph CommitFlow["/commit Workflow"]
        C1["Stage Changes"] --> C2["Analyze Diff"]
        C2 --> C3["Detect Commit Style"]
        C3 --> C4["Generate Message"]
        C4 --> C5["git commit"]
    end
    subgraph FullFlow["/commit-push-pr Workflow"]
        F1["Stage Changes"] --> F2["Analyze Diff"]
        F2 --> F3["Generate Message"]
        F3 --> F4["git commit"]
        F4 --> F5["Ensure Branch"]
        F5 --> F6["git push"]
        F6 --> F7["Create PR"]
        F7 --> F8["Output PR URL"]
    end
    subgraph CleanFlow["/clean_gone Workflow"]
        G1["git fetch --prune"] --> G2["List Local Branches"]
        G2 --> G3["Check Tracking Refs"]
        G3 --> G4{"Upstream
Gone?"} G4 -->|Yes| G5["Delete Branch"] G4 -->|No| G6["Keep Branch"] end

Commands

CommandDescriptionArguments
/commitStages all changes, analyzes the diff, detects the project's commit message style (Conventional Commits, Gitmoji, etc.), generates an appropriate message, and commits.--amend amend previous commit, --no-stage skip auto-staging, --style <name> force style
/commit-push-prFull workflow: commit with auto-message, ensure a feature branch exists, push, and create a pull request with auto-generated title and description.--draft create draft PR, --base <branch> target branch (default: main), --reviewer <user> request reviewer
/clean_goneFetches with prune, identifies local branches whose upstream tracking reference is gone, and deletes them. Skips protected branches (main, master, develop).--dry-run list without deleting, --force force-delete unmerged branches

Commit Style Detection

The plugin automatically detects the project's commit message style by analyzing the last 20 commits in the repository. It supports these formats:

📝 Conventional Commits

Structured format: type(scope): description

feat(auth): add OAuth2 login flow
fix(api): handle null response in user endpoint
chore(deps): bump express to 4.19.2

🎨 Gitmoji

Emoji-prefixed messages for visual git logs

✨ Add search autocomplete
🐛 Fix date parsing in UTC timezone
♻️ Refactor database connection pool

📄 Simple Imperative

Plain imperative mood sentences, capitalized

Add user profile page
Fix broken navigation on mobile
Update README with deployment steps

Data Flow

sequenceDiagram
    participant User
    participant Plugin as /commit-push-pr
    participant Git as Git CLI
    participant Style as Style Detector
    participant GH as GitHub CLI

    User->>Plugin: /commit-push-pr --draft
    Plugin->>Git: git diff --staged (check for changes)
    Git-->>Plugin: No staged changes
    Plugin->>Git: git add -A
    Git-->>Plugin: All files staged
    Plugin->>Git: git log --oneline -20
    Git-->>Plugin: Recent commit history
    Plugin->>Style: Detect commit style
    Style-->>Plugin: "conventional" detected
    Plugin->>Plugin: Generate: "feat(ui): add dashboard widgets"
    Plugin->>Git: git commit -m "feat(ui): add dashboard widgets"
    Git-->>Plugin: Committed on feature/dashboard
    Plugin->>Git: git push -u origin feature/dashboard
    Git-->>Plugin: Push successful
    Plugin->>GH: gh pr create --draft --base main
    GH-->>Plugin: PR #73 created
    Plugin-->>User:  Committed, pushed, PR #73 (draft)

Key Components

ComponentFileRole
commitcommands/commit.mdStage, analyze, and commit with auto-generated message
commit-push-prcommands/commit-push-pr.mdFull workflow from commit through PR creation
clean_gonecommands/clean_gone.mdPrune local branches with gone upstream refs
style-detectorlib/style-detector.mdAnalyzes git history to detect commit message convention
plugin.json.claude-plugin/plugin.jsonPlugin manifest with command registration

Interactions

ModuleInterfaceData Exchanged
Git CLIShell commandsDiff, log, stage, commit, push, branch operations
GitHub CLI (gh)PR creationTitle, body, base branch, draft flag, reviewer
CLAUDE.mdFile readProject-specific commit message conventions
Project git historygit logRecent commits for style detection analysis

Directory Map

Source tree for Commit Commands
commit-commands/
├── .claude-plugin/plugin.json          ← Plugin manifest
├── README.md                           ← Plugin documentation
├── commands/
│   ├── commit.md                       ← Auto-message commit command
│   ├── commit-push-pr.md               ← Full workflow command
│   └── clean_gone.md                   ← Stale branch cleanup
└── lib/
    └── style-detector.md               ← Commit style analysis

Configuration Reference

ParameterDefaultDescription
default_styleautoCommit style: auto, conventional, gitmoji, simple
auto_stagetrueAutomatically stage all changes before commit
default_basemainDefault base branch for PR creation
protected_branches["main","master","develop"]Branches that /clean_gone will never delete
pr_draftfalseCreate PRs as drafts by default
commit_scopeautoHow to determine scope: auto (from path), manual, or none

Usage Examples

# Simple commit with auto-detected style
/commit

# Full workflow: commit, push, create draft PR
/commit-push-pr --draft --reviewer @teammate

# Preview which branches would be cleaned
/clean_gone --dry-run

# Force a specific commit style
/commit --style gitmoji

# Amend the previous commit message
/commit --amend