# Workflow Git/Gitea — main protégé (PR only) ## Objectif Éviter toute casse de `main` : on travaille **toujours** via branche + Pull Request. ## 1) Démarrer propre (local) en bash : git fetch origin --prune git checkout main git reset --hard origin/main git clean -fd ## 2) Créer une branche git checkout -b fix/ma-modif ## 3) Modifier, tester, commit npm test git add -A git commit -m "Mon changement" ## 4) Push (création branche distante) git push -u origin fix/ma-modif ## 5) Créer la Pull Request (UI Gitea) Gitea → repository → Pull Requests → New Pull Request base : main compare : fix/ma-modif Si “je ne vois pas de PR” Vérifie d’abord qu’il y a un diff réel : git log --oneline origin/main..HEAD Si la commande ne sort rien : ta branche ne contient aucun commit différent → PR inutile/invisible. ## 6) Conflits Ne merge pas en local vers main (push refusé si main protégé). On met à jour la branche de PR : Option A (simple) : merge main dans la branche git fetch origin git merge origin/main # résoudre conflits npm test git push Option B (plus propre) : rebase git fetch origin git rebase origin/main # résoudre conflits, puis: npm test git push --force-with-lease ## 7) Merge Toujours depuis l’UI de la Pull Request (ou via un mainteneur).