$npx -y skills add github/awesome-copilot --skill git-commitExecute git commit with conventional commit message analysis, intelligent staging, and message generation. Use when user asks to commit changes, create a git commit, or mentions "/commit". Supports: (1) Auto-detecting type and scope from changes, (2) Generating conventional commi
| 1 | # Git Commit with Conventional Commits |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | Create standardized, semantic git commits using the Conventional Commits specification. Analyze the actual diff to determine appropriate type, scope, and message. |
| 6 | |
| 7 | ## Conventional Commit Format |
| 8 | |
| 9 | ``` |
| 10 | <type>[optional scope]: <description> |
| 11 | |
| 12 | [optional body] |
| 13 | |
| 14 | [optional footer(s)] |
| 15 | ``` |
| 16 | |
| 17 | ## Commit Types |
| 18 | |
| 19 | | Type | Purpose | |
| 20 | | ---------- | ------------------------------ | |
| 21 | | `feat` | New feature | |
| 22 | | `fix` | Bug fix | |
| 23 | | `docs` | Documentation only | |
| 24 | | `style` | Formatting/style (no logic) | |
| 25 | | `refactor` | Code refactor (no feature/fix) | |
| 26 | | `perf` | Performance improvement | |
| 27 | | `test` | Add/update tests | |
| 28 | | `build` | Build system/dependencies | |
| 29 | | `ci` | CI/config changes | |
| 30 | | `chore` | Maintenance/misc | |
| 31 | | `revert` | Revert commit | |
| 32 | |
| 33 | ## Breaking Changes |
| 34 | |
| 35 | ``` |
| 36 | # Exclamation mark after type/scope |
| 37 | feat!: remove deprecated endpoint |
| 38 | |
| 39 | # BREAKING CHANGE footer |
| 40 | feat: allow config to extend other configs |
| 41 | |
| 42 | BREAKING CHANGE: `extends` key behavior changed |
| 43 | ``` |
| 44 | |
| 45 | ## Workflow |
| 46 | |
| 47 | ### 1. Analyze Diff |
| 48 | |
| 49 | ```bash |
| 50 | # If files are staged, use staged diff |
| 51 | git diff --staged |
| 52 | |
| 53 | # If nothing staged, use working tree diff |
| 54 | git diff |
| 55 | |
| 56 | # Also check status |
| 57 | git status --porcelain |
| 58 | ``` |
| 59 | |
| 60 | ### 2. Stage Files (if needed) |
| 61 | |
| 62 | If nothing is staged or you want to group changes differently: |
| 63 | |
| 64 | ```bash |
| 65 | # Stage specific files |
| 66 | git add path/to/file1 path/to/file2 |
| 67 | |
| 68 | # Stage by pattern |
| 69 | git add *.test.* |
| 70 | git add src/components/* |
| 71 | |
| 72 | # Interactive staging |
| 73 | git add -p |
| 74 | ``` |
| 75 | |
| 76 | **Never commit secrets** (.env, credentials.json, private keys). |
| 77 | |
| 78 | ### 3. Generate Commit Message |
| 79 | |
| 80 | Analyze the diff to determine: |
| 81 | |
| 82 | - **Type**: What kind of change is this? |
| 83 | - **Scope**: What area/module is affected? |
| 84 | - **Description**: One-line summary of what changed (present tense, imperative mood, <72 chars) |
| 85 | |
| 86 | ### 4. Execute Commit |
| 87 | |
| 88 | ```bash |
| 89 | # Single line |
| 90 | git commit -m "<type>[scope]: <description>" |
| 91 | |
| 92 | # Multi-line with body/footer |
| 93 | git commit -m "$(cat <<'EOF' |
| 94 | <type>[scope]: <description> |
| 95 | |
| 96 | <optional body> |
| 97 | |
| 98 | <optional footer> |
| 99 | EOF |
| 100 | )" |
| 101 | ``` |
| 102 | |
| 103 | ## Best Practices |
| 104 | |
| 105 | - One logical change per commit |
| 106 | - Present tense: "add" not "added" |
| 107 | - Imperative mood: "fix bug" not "fixes bug" |
| 108 | - Reference issues: `Closes #123`, `Refs #456` |
| 109 | - Keep description under 72 characters |
| 110 | |
| 111 | ## Git Safety Protocol |
| 112 | |
| 113 | - NEVER update git config |
| 114 | - NEVER run destructive commands (--force, hard reset) without explicit request |
| 115 | - NEVER skip hooks (--no-verify) unless user asks |
| 116 | - NEVER force push to main/master |
| 117 | - If commit fails due to hooks, fix and create NEW commit (don't amend) |