</>
Plan du cours — 60/74

Bisect : trouver le commit qui a introduit un bug

Avancé

git bisect fait une recherche dichotomique dans l'historique pour identifier automatiquement le commit fautif.

# Démarrer la recherche
git bisect start

# Indiquer un commit où le bug est présent (souvent HEAD)
git bisect bad

# Indiquer un commit où le bug n'existait pas encore (ex: le dernier tag stable)
git bisect good v1.0.0

# Git se place sur un commit "au milieu" : testez, puis répondez
git bisect good   # si le bug n'est pas présent ici
git bisect bad    # si le bug est présent ici

# Répétez jusqu'à ce que Git identifie le commit fautif exact

# Terminer et revenir à votre branche de départ
git bisect reset
# Version automatisée : Git exécute un script/test à chaque étape
git bisect start HEAD v1.0.0
git bisect run npm test