Créer un commit Git

VérifiéPrudence

Crée un commit git avec un message formaté selon les conventions du projet. Stade automatiquement les changements et génère des sujets de commit atomiques et descriptifs. Utile pour sauvegarder l'avancement ou finaliser une tâche, garantissant des commits propres et facilement révisables.

Spar Skills Guide Bot
DeveloppementDébutant
8002/06/2026
Claude CodeCursorWindsurfCopilotCodex
#git#commit#version-control#atomic-commits

Recommandé pour

Notre avis

Crée des commits Git en suivant les conventions de projet, avec un format de message strict et des instructions pour un historique propre.

Points forts

  • Messages de commit clairs et cohérents
  • Encourage les commits atomiques
  • Évite les anti-patrons comme les redondances ou les étapes d'implémentation

Limites

  • Ne gère pas les conflits de fusion
  • Peut ne pas capturer le contexte complet si le message est trop court
  • Dépend de la configuration Git existante (hooks, conventions)
Quand l'utiliser

Utilisez cette compétence chaque fois que vous devez enregistrer des modifications dans Git avec un message bien formaté.

Quand l'éviter

Ne l'utilisez pas lorsque vous avez besoin d'un commit complexe avec plusieurs modifications non liées ou lorsque vous devez modifier l'historique existant.

Analyse de sécurité

Prudence
Score qualité92/100

The skill uses git commands that modify the repository, which is a powerful action. However, it includes safety guidelines to avoid force pushing and amending others' commits, and it does not engage in destructive or exfiltrating behavior. The risk is legitimate for the task.

Points d'attention
  • The skill instructs the AI to stage and commit changes to the repository, which could result in unintended commits or loss of work if misused.

Exemples

Commit staged changes
Commit my staged changes with a message following the standard format.
Commit unstaged changes
Create a commit for all unstaged changes with a descriptive subject line.
Commit with body
Commit the current changes with a subject line 'Add user authentication' and a body explaining the new feature.

name: commit description: Use when creating a git commit for staged or unstaged changes. Triggers on "commit this", "save my changes", or when implementation work completes and needs version control.

Commit Changes

Create a git commit following project conventions.

Commit Message Format

Subject line: Imperative mood, 50 chars max, capitalized, no period

  • "Add spectrum analyzer" NOT "Added spectrum analyzer"
  • Test: "If applied, this commit will [your subject]"

Body: Optional. Most commits need only a subject line. When included:

  • State WHAT capability exists after this commit (1-2 sentences max)
  • Skip if subject line is self-explanatory

Anti-patterns (never include):

  • Implementation journey ("was implemented and reverted", "tried X then Y")
  • Redundant expansion of subject ("This adds..." when subject says "Add...")
  • Phase/step references from planning docs
  • Rationale for rejected approaches

Scope: One logical change per commit. Atomic commits simplify review and revert.

Instructions

  1. Run git status and git diff --staged (or git diff if nothing staged) to understand changes
  2. Run git log --oneline -5 to see recent commit style
  3. Draft a commit message following the format above
  4. Stage relevant files and commit:

Simple commit (preferred):

git commit -m "Add vertical offset parameter for linear waveforms"

With body (only when subject needs clarification):

git commit -m "$(cat <<'EOF'
Add vertical offset parameter for linear waveforms

Enables vertical stacking of multiple waveforms in linear mode.
EOF
)"

Safety

  • NEVER amend commits you didn't create (check git log -1 --format='%an %ae')
  • NEVER force push to main/master
  • NEVER skip hooks unless explicitly requested
Skills similaires