git bisect
git
Syntaxe
git bisect start <bad> <good>Coupe en deux l'intervalle de commits pour trouver le premier fautif ; il faut conclure par git bisect reset, sinon vous restez sur un commit détaché.
Options courantes
| Option | Signification |
|---|---|
| start <bad> <good> | begin, naming a broken and a working commit |
| good | mark the checked-out commit as working |
| bad | mark it as broken |
| skip | this commit cannot be tested |
| run <cmd> | let a command decide by its exit code |
| reset | stop and go back to where you were |
Exemples
git bisect start HEAD v1.1.0starts the search between the last release and now
git bisect run npm testfinds the first failing commit with no further input
git bisect resetends the session; skipping this leaves you on a detached commit
Ce qui embrouille, c’est qu’annuler a plusieurs formes : déplacer là où pointe une branche n’est pas ajouter un commit qui l’inverse.
Comment lire
- Les crochets [ ] marquent une partie facultative.
- Les points de suspension … signifient qu’on peut en mettre plusieurs.
- Les options sont sensibles à la casse : sur certaines commandes, -r et -R ne font pas la même chose.
Questions fréquentes
Q. Que fait git bisect ?
Coupe en deux l'intervalle de commits pour trouver le premier fautif ; il faut conclure par git bisect reset, sinon vous restez sur un commit détaché.
Q. Comment l’écrire ?
git bisect start <bad> <good> — les crochets marquent ce qui est facultatif.
Q. Combien d’options valent la peine ?
Il y en a 6 ici ; la liste complète est dans man git. Cette commande relève de git.
Commandes liées
page man: man git-bisect