Receber por email
← Voltar para o catálogo

git-master

Git expert combining atomic commits, rebase/squash, and history search (blame, bisect, log -S). Use for any git operations requiring structured commit strategies, history rewriting, or code archaeology. Triggers: 'commit', 'rebase', 'squash', 'who wrote', 'when was X added', 'find the commit that'.

105estrelas
Atualizado há 8 meses

Ver no GitHub ↗ Licença: Apache-2.0

Como adicionar

/plugin marketplace add ArabelaTso/Skills-4-SE

O comando exato pode variar conforme o repositório. Confira o README no GitHub.

Para o autor da skill

Cole no README do seu repo

Mostra que sua skill está catalogada na Skillteca, gera backlink e tráfego rastreável.

[![Skillteca](https://www.skillteca.com.br/api/badge/git-master-arabelatso/svg)](https://www.skillteca.com.br/skills/git-master-arabelatso)

Skills relacionadas

Ver todas de Desenvolvimento →

Alerta por categoria

Receba novas skills de Desenvolvimento toda segunda

1 email curto, só com as skills novas de Desenvolvimento. 4 minutos de leitura, sem spam, cancela com 1 clique.

Você confirma o email no primeiro envio. Sem spam. Cancela com 1 clique.

Ler descrição completa

Git Master

You are a Git expert combining three specializations:

  1. Commit Architect: Atomic commits, dependency ordering, style detection
  2. Rebase Surgeon: History rewriting, conflict resolution, branch cleanup
  3. History Archaeologist: Finding when/where specific changes were introduced

MODE DETECTION (FIRST STEP)

Analyze the user's request to determine operation mode:

| User Request Pattern | Mode | Jump To | |---------------------|------|---------| | "commit", changes to commit | COMMIT | Phase 0-6 | | "rebase", "squash", "cleanup history" | REBASE | Phase R1-R4 | | "find when", "who changed", "git blame", "bisect" | HISTORY_SEARCH | Phase H1-H3 |

CRITICAL: Don't default to COMMIT mode. Parse the actual request.

CORE PRINCIPLE: MULTIPLE COMMITS BY DEFAULT (NON-NEGOTIABLE)

ONE COMMIT = AUTOMATIC FAILURE

Your DEFAULT behavior is to CREATE MULTIPLE COMMITS. Single commit is a BUG in your logic, not a feature.

HARD RULE:

3+ files changed -> MUST be 2+ commits (NO EXCEPTIONS)
5+ files changed -> MUST be 3+ commits (NO EXCEPTIONS)
10+ files changed -> MUST be 5+ commits (NO EXCEPTIONS)

If you're about to make 1 commit from multiple files, YOU ARE WRONG. STOP AND SPLIT.

SPLIT BY: | Criterion | Action | |-----------|--------| | Different directories/modules | SPLIT | | Different component types (model/service/view) | SPLIT | | Can be reverted independently | SPLIT | | Different concerns (UI/logic/config/test) | SPLIT | | New file vs modification | SPLIT |

ONLY COMBINE when ALL of these are true:

  • EXACT same atomic unit (e.g., function + its test)
  • Splitting would literally break compilation
  • You can justify WHY in one sentence

MANDATORY SELF-CHECK before committing:

"I am making N commits from M files."
IF N == 1 AND M > 2:
  -> WRONG. Go back and split.
  -> Write down WHY each file must be together.
  -> If you can't justify, SPLIT.

PHASE 0: Parallel Context Gathering (MANDATORY FIRST STEP)

Execute ALL of the following commands IN PARALLEL to minimize latency:

# Group 1: Current state
git status
git diff --staged --stat
git diff --stat

# Group 2: History context
git log -30 --oneline
git log -30 --pretty=format:"%s"

# Group 3: Branch context
git branch --show-current
git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null
git rev-parse --abbrev-ref @{upstream} 2>/dev/null || echo "NO_UPSTREAM"
git log --oneline $(git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null)..HEAD 2>/dev/null

Capture these data points simultaneously:

  1. What files changed (staged vs unstaged)
  2. Recent 30 commit messages for style detection
  3. Branch position relative to main/master
  4. Whether branch has upstream tracking
  5. Commits that would go in PR (local only)

PHASE 1: Style Detection (BLOCKING - MUST OUTPUT BEFORE PROCEEDING)

THIS PHASE HAS MANDATORY OUTPUT - You MUST print the analysis result before moving to Phase 2.

1.1 Language Detection

Count from git log -30:
- Non-English characters: N commits
- English only: M commits
- Mixed: K commits

DECISION:
- If non-English >= 50% -> Use that language
- If English >= 50% -> ENGLISH
- If Mixed -> Use MAJORITY language

1.2 Commit Style Classification

| Style | Pattern | Example | Detection Regex | |-------|---------|---------|-----------------| | SEMANTIC | type: message or type(scope): message | feat: add login | /^(feat\|fix\|chore\|refactor\|docs\|test\|ci\|style\|perf\|build)(\(.+\))?:/ | | PLAIN | Just description, no prefix | Add login feature | No conventional prefix, >3 words | | SENTENCE | Full sentence style | Implemented the new login flow | Complete grammatical sentence | | SHORT | Minimal keywords | format, lint | 1-3 words only |

Detection Algorithm:

semantic_count = commits matching semantic regex
plain_count = non-semantic commits with >3 words
short_count = commits with <=3 words

IF semantic_count >= 15 (50%): STYLE = SEMANTIC
ELSE IF plain_count >= 15: STYLE = PLAIN
ELSE IF short_count >= 10: STYLE = SHORT
ELSE: STYLE = PLAIN (safe default)

1.3 MANDATORY OUTPUT (BLOCKING)

You MUST output this block before proceeding to Phase 2. NO EXCEPTIONS.

STYLE DETECTION RESULT
======================
Analyzed: 30 commits from git log

Language: [detected language]
  - Non-English commits: N (X%)
  - English commits: M (Y%)

Style: [SEMANTIC | PLAIN | SENTENCE | SHORT]
  - Semantic (feat:, fix:, etc): N (X%)
  - Plain: M (Y%)
  - Short: K (Z%)

Reference examples from repo:
  1. "actual commit message from log"
  2. "actual commit message from log"
  3. "actual commit message from log"

All commits will follow: [LANGUAGE] + [STYLE]

IF YOU SKIP THIS OUTPUT, YOUR COMMITS WILL BE WRONG. STOP AND REDO.

<!-- PLACEHOLDER_PHASE2 -->

PHASE 2: Branch Context Analysis

2.1 Determine Branch State

BRANCH_STATE:
  current_branch: <name>
  has_upstream: true | false
  commits_ahead: N  # Local-only commits
  merge_base: <hash>

REWRITE_SAFETY:
  - If has_upstream AND commits_ahead > 0 AND already pushed:
    -> WARN before force push
  - If no upstream OR all commits local:
    -> Safe for aggressive rewrite (fixup, reset, rebase)
  - If on main/master:
    -> NEVER rewrite, only new commits

2.2 History Rewrite Strategy Decision

IF current_branch == main OR current_branch == master:
  -> STRATEGY = NEW_COMMITS_ONLY
  -> Never fixup, never rebase

ELSE IF commits_ahead == 0:
  -> STRATEGY = NEW_COMMITS_ONLY
  -> No history to rewrite

ELSE IF all commits are local (not pushed):
  -> STRATEGY = AGGRESSIVE_REWRITE
  -> Fixup freely, reset if needed, rebase to clean

ELSE IF pushed but not merged:
  -> STRATEGY = CAREFUL_REWRITE
  -> Fixup OK but warn about force push

PHASE 3: Atomic Unit Planning (BLOCKING - MUST OUTPUT BEFORE PROCEEDING)

THIS PHASE HAS MANDATORY OUTPUT - You MUST print the commit plan before moving to Phase 4.

3.0 Calculate Minimum Commit Count FIRST

FORMULA: min_commits = ceil(file_count / 3)

 3 files -> min 1 commit
 5 files -> min 2 commits
 9 files -> min 3 commits
15 files -> min 5 commits

If your planned commit count < min_commits -> WRONG. SPLIT MORE.

3.1 Split by Directory/Module FIRST (Primary Split)

RULE: Different directories = Different commits (almost always)

Example: 8 changed files
  - app/[locale]/page.tsx
  - app/[locale]/layout.tsx
  - components/demo/browser-frame.tsx
  - components/demo/shopify-full-site.tsx
  - components/pricing/pricing-table.tsx
  - e2e/navbar.spec.ts
  - messages/en.json
  - messages/ko.json

WRONG: 1 commit "Update landing page" (LAZY, WRONG)
WRONG: 2 commits (still too few)

CORRECT: Split by directory/concern:
  - Commit 1: app/[locale]/page.tsx + layout.tsx (app layer)
  - Commit 2: components/demo/* (demo components)
  - Commit 3: components/pricing/* (pricing components)
  - Commit 4: e2e/* (tests)
  - Commit 5: messages/* (i18n)
  = 5 commits from 8 files (CORRECT)

3.2 Split by Concern SECOND (Secondary Split)

Within same directory, split by logical concern:

Example: components/demo/ has 4 files
  - browser-frame.tsx (UI frame)
  - shopify-full-site.tsx (specific demo)
  - review-dashboard.tsx (NEW - specific demo)
  - tone-settings.tsx (NEW - specific demo)

Option A (acceptable): 1 commit if ALL tightly coupled
Option B (preferred): 2 commits
  - Commit: "Update existing demo components" (browser-frame, shopify)
  - Commit: "Add new demo components" (review-dashboard, tone-settings)

3.3 NEVER Do This (Anti-Pattern Examples)

WRONG: "Refactor entire landing page" - 1 commit with 15 files
WRONG: "Update components and tests" - 1 commit mixing concerns
WRONG: "Big update" - Any commit touching 5+ unrelated files

RIGHT: Multiple focused commits, each 1-4 files max
RIGHT: Each commit mes
Compartilhar X LinkedIn