Aller au contenu
Skillpedia
Déploiement et cloud (DevOps)107k · #773

git-workflow-and-versioning

Ce qu’il fait

Cet outil vous aide à organiser le code que vous et l'IA créez. Il vous apprend à sauvegarder votre travail souvent (commits), à travailler sur des parties distinctes du code (branches) et à leur donner des noms clairs, afin que tout reste organisé et facile à corriger en cas de problème.

Quand l’utiliser

  • ✓Chaque fois que vous ou l'IA modifiez le code.
  • ✓Lorsque vous enregistrez votre progression (commit) ou que vous créez une nouvelle ligne de travail (branche).
  • ✓Lorsque vous devez mener plusieurs tâches différentes en parallèle.

Lien du skill

https://github.com/addyosmani/agent-skills/blob/main/skills/git-workflow-and-versioning/SKILL.md

Copiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.

Comment l’utiliser

Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.

Message prêt à coller

Utilise ce skill pour m’aider : https://github.com/addyosmani/agent-skills/blob/main/skills/git-workflow-and-versioning/SKILL.md Lis le fichier SKILL.md de ce lien et suis ses instructions pour ma tâche.
Envie que votre IA trouve seule des skills comme celui-ci ?Installez le MCP gratuit de Skillpedia : une ligne, et elle cherche parmi 15 000+ skills avant chaque tâche.Installer en 1 minute →

Exemple de demande à votre IA

“Comment puis-je enregistrer mon travail actuel dans une nouvelle « version » organisée ?”

5 nouveaux skills par semaine. 1 minute de lecture.

Comment ça marche

L'IA vous suggère d'enregistrer souvent de petits morceaux de travail, comme des « points de sauvegarde ». Chaque enregistrement (commit) ne doit faire qu'une seule chose logique et avoir un message qui explique pourquoi il a été fait, et pas seulement ce qui a été fait.

Contenu technique (SKILL.md original)

Texte original de l’auteur, en anglais, directement depuis GitHub.

Git Workflow and Versioning

Overview

Git is your safety net. Treat commits as save points, branches as sandboxes, and history as documentation. With AI agents generating code at high speed, disciplined version control is the mechanism that keeps changes manageable, reviewable, and reversible.

When to Use

Always. Every code change flows through git.

Core Principles

Trunk-Based Development (Recommended)

Keep main always deployable. Work in short-lived feature branches that merge back within 1-3 days. Long-lived development branches are hidden costs — they diverge, create merge conflicts, and delay integration. DORA research consistently shows trunk-based development correlates with high-performing engineering teams.

main ──●──●──●──●──●──●──●──●──●──  (always deployable)
        ╲      ╱  ╲    ╱
         ●──●─╱    ●──╱    ← short-lived feature branches (1-3 days)

This is the recommended default. Teams using gitflow or long-lived branches can adapt the principles (atomic commits, small changes, descriptive messages) to their branching model — the commit discipline matters more than the specific branching strategy.

  • Dev branches are costs. Every day a branch lives, it accumulates merge risk.
  • Release branches are acceptable. When you need to stabilize a release while main moves forward.
  • Feature flags > long branches. Prefer deploying incomplete work behind flags rather than keeping it on a branch for weeks.

1. Commit Early, Commit Often

Each successful increment gets its own commit. Don't accumulate large uncommitted changes.

Work pattern:
  Implement slice → Test → Verify → Commit → Next slice

Not this:
  Implement everything → Hope it works → Giant commit

Commits are save points. If the next change breaks something, you can revert to the last known-good state instantly.

2. Atomic Commits

Each commit does one logical thing:

# Good: Each commit is self-contained
git log --oneline
a1b2c3d Add task creation endpoint with validation
d4e5f6g Add task creation form component
h7i8j9k Connect form to API and add loading state
m1n2o3p Add task creation tests (unit + integration)

# Bad: Everything mixed together
git log --oneline
x1y2z3a Add task feature, fix sidebar, update deps, refactor utils

3. Descriptive Messages

Commit messages explain the why, not just the what:

# Good: Explains intent
feat: add email validation to registration endpoint

Prevents invalid email formats from reaching the database.
Uses Zod schema validation at the route handler level,
consistent with existing validation patterns in auth.ts.

# Bad: Describes what's obvious from the diff
update auth.ts

Format:

<type>: <short description>

<optional body explaining why, not what>

Types:

  • feat — New feature
  • fix — Bug fix
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests
  • docs — Documentation only
  • chore — Tooling, dependencies, config

4. Keep Concerns Separate

Don't combine formatting changes with behavior changes. Don't combine refactors with features. Each type of change should be a separate commit — and ideally a separate PR:

# Good: Separate concerns
git commit -m "refactor: extract validation logic to shared utility"
git commit -m "feat: add phone number validation to registration"

# Bad: Mixed concerns
git commit -m "refactor validation and add phone number field"

Separate refactoring from feature work. A refactoring change and a feature change are two different changes — submit them separately. This makes each change easier to review, revert, and understand in history. Small cleanups (renaming a variable) can be included in a feature commit at reviewer discretion.

5. Size Your Changes

Target ~100 lines per commit/PR. Changes over ~1000 lines should be split. See the splitting strategies in code-review-and-quality for how to break down large changes.

~100 lines  → Easy to review, easy to revert
~300 lines  → Acceptable for a single logical change
~1000 lines → Split into smaller changes

Branching Strategy

Feature Branches

main (always deployable)
  │
  ├── feature/task-creation    ← One feature per branch
  ├── feature/user-settings    ← Parallel work
  └── fix/duplicate-tasks      ← Bug fixes
  • Branch from main (or the team's default branch)

…

Questions fréquentes

Qu'est-ce qu'un « commit » ?

Un « commit » est comme un point de sauvegarde de votre projet. Il enregistre un ensemble de modifications apportées au code, ce qui vous permet de revenir à cette version si nécessaire.

Qu'est-ce qu'une « branche » ?

Une « branche » est une copie séparée de votre projet sur laquelle vous pouvez travailler sur de nouvelles idées ou corrections sans affecter la version principale. C'est un espace sûr pour expérimenter.

Pourquoi est-il important de sauvegarder souvent ?

Sauvegarder fréquemment (commits atomiques) vous évite de perdre votre travail et facilite l'identification et la correction des problèmes. Si quelque chose casse, vous pouvez revenir facilement à un point de sauvegarde qui fonctionnait.

Détails

Description originale de l’auteur

Structures git workflow practices. Use when making any code change. Use when committing, branching, resolving conflicts, splitting uncommitted work in a messy working tree into clean atomic commits, opening or reviewing a pull request (PR), pushing to a remote, or when you need to organize work across multiple parallel streams. Use when cutting a release, choosing a semantic version bump, tagging,

repo: addyosmani/agent-skills

Popularité

Étoiles GitHub
107k
Position au classement
#773
Licence
MIT
Mis à jour
13/10/2026

Ce skill vous est-il utile ?

0

Connectez-vous pour voter.

Commentaires

  • …

Autres skills de ce dépôt

Skills similaires