agentleFS
eliabdevweb-svgeliabdevweb-svg/opencode-skills-MCP/skills/git-workflow/SKILL.md

git-workflow

Skill0 starsChanged 28 days agoMITView on GitHub

Workflow Git professionnel, branching strategies, commit conventions, et collaboration d'équipe. Use when creating branches, writing or fixing commits, rebasing, resolving merge conflicts, reviewing pull requests, or when the user mentions git, branche, commit, merge, rebase ou convention de commit.

  • Reads credentials
  • Deletes or force-pushes
  • Commits and pushes
Files
SKILL.md

Git Workflow

Guide pour un workflow Git professionnel et une collaboration d'équipe efficace.

Branching Strategy

Git Flow

main (production)
├── develop (intégration)
│   ├── feature/user-auth
│   ├── feature/payment
│   └── feature/dashboard
├── release/v1.2.0
└── hotfix/critical-bug

GitHub Flow (Recommandé)

main (production)
├── feature/user-auth
├── feature/payment
└── feature/dashboard

Règles :

  • main est toujours déployable
  • Toutes les branches partent de main
  • Les PRs sont requises pour merger
  • Le CI doit passer avant le merge

Conventional Commits

Format

<type>(<scope>): <subject>

<body>

<footer>

Types

TypeDescriptionExemple
featNouvelle fonctionnalitéfeat(auth): add OAuth login
fixCorrection de bugfix(api): handle null response
docsDocumentationdocs(readme): update install steps
styleFormatage (pas de changement logique)style: fix prettier issues
refactorRefactorisationrefactor(auth): extract validation
perfAmélioration de performanceperf(api): add caching
testAjout de teststest(auth): add unit tests
buildBuild systembuild: update webpack config
ciCI/CDci: add github actions
choreMaintenancechore: update dependencies
revertRevertrevert: feat(auth): add OAuth

Exemples

# Feature
git commit -m "feat(user): add profile page"

# Fix
git commit -m "fix(auth): prevent token expiration race condition"

# Breaking change
git commit -m "feat(api)!: change response format

BREAKING CHANGE: API responses now use camelCase instead of snake_case"

# Avec body
git commit -m "feat(payment): add Stripe integration

- Add Stripe SDK
- Create payment intent endpoint
- Handle webhook events
- Add idempotency keys

Closes #123"

Workflow Quotidien

1. Début de journée

# Récupérer les dernières modifications
git fetch origin
git checkout main
git pull origin main

# Créer ou mettre à jour sa branche feature
git checkout -b feature/my-feature
# ou
git checkout feature/my-feature
git rebase main

2. Pendant le développement

# Travailler par petits commits
git add -p  # Stage sélectif
git commit -m "feat(auth): add login form"

# Pousser régulièrement
git push origin feature/my-feature

3. Avant de créer une PR

# Nettoyer l'historique
git rebase -i main

# Squasher les commits de wip
git rebase -i HEAD~5

# Pousser avec force (après rebase)
git push origin feature/my-feature --force-with-lease

4. Créer une PR

# Depuis GitHub CLI
gh pr create \
  --title "feat(auth): add OAuth login" \
  --body "## Description
Add OAuth login with Google and GitHub

## Changes
- Add OAuth provider configuration
- Create callback handlers
- Add session management

## Testing
- [ ] Unit tests added
- [ ] Integration tests pass
- [ ] Manual testing done

Closes #123" \
  --reviewer team-leads

Rebase vs Merge

Rebase (Recommandé pour les features)

# Avant
main: A → B → C
feature: D → E

# Après rebase
main: A → B → C
feature: D' → E' (rejoués sur C)

# Commande
git checkout feature
git rebase main

Avantages : Historique linéaire, propre Inconvénients : Réécrit l'historique, dangereux sur les branches partagées

Merge (Recommandé pour les releases)

# Après merge
main: A → B → C → M (merge commit)
feature: D → E

# Commande
git checkout main
git merge feature

Avantages : Préserve l'historique, sûr pour les branches partagées Inconvénients : Historique plus complexe

Sauvegarde et Récupération

Stash

# Sauvegarder les changements
git stash push -m "work in progress"

# Lister les stashes
git stash list

# Récupérer le stash
git stash pop

# Récupérer un stash spécifique
git stash apply stash@{1}

Undo

# Annuler le dernier commit (garder les changements)
git reset --soft HEAD~1

# Annuler le dernier commit (perdre les changements)
git reset --hard HEAD~1

# Annuler un push (dangereux)
git push --force-with-lease

# Révertir un commit (crée un nouveau commit)
git revert <commit-hash>

Git Hooks

Husky + lint-staged

// package.json
{
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged",
      "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
    }
  },
  "lint-staged": {
    "*.{ts,tsx}": ["eslint --fix", "prettier --write"],
    "*.{json,md}": ["prettier --write"]
  }
}

Commitlint

// commitlint.config.js
module.exports = {
  extends: ['@commitlint/config-conventional'],
  rules: {
    'type-enum': [2, 'always', [
      'feat', 'fix', 'docs', 'style', 'refactor',
      'perf', 'test', 'build', 'ci', 'chore', 'revert'
    ]],
    'subject-max-length': [2, 'always', 72]
  }
};

Commands Utiles

# Information
git log --oneline --graph --all  # Visualiser l'historique
git diff main                    # Diff avec main
git blame file.ts                # Qui a écrit quoi
git shortlog -sn                 # Contributeurs

# Nettoyage
git gc --aggressive              # Garbage collection
git clean -fd                    # Supprimer les fichiers non trackés

# Avancé
git bisect start                 # Trouver le commit qui a cassé
git bisect bad                   # Commit actuel est mauvais
git bisect good <commit>         # Ce commit était bon

Checklist PR

  • Le code suit-il les conventions de commit ?
  • Les tests passent-ils ?
  • Le lint passe-t-il ?
  • La documentation est-elle mise à jour ?
  • Les breaking changes sont-ils documentés ?
  • Le reviewer est-il assigné ?
  • La description de la PR est-elle claire ?

Anti-Patterns

PatternProblèmeSolution
Force push sur mainPerd l'historiqueUtiliser des PRs
Grand commitDifficile à reviewSéparer par fonctionnalité
Merge sans PRPas de reviewToujours passer par des PRs
Commit de secretsSécurité compromiseUtiliser des .env
Historique saleDifficile à naviguerUtiliser rebase régulièrement

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.