Accueil·Commandes du terminal

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

OptionSignification
start <bad> <good>begin, naming a broken and a working commit
goodmark the checked-out commit as working
badmark it as broken
skipthis commit cannot be tested
run <cmd>let a command decide by its exit code
resetstop and go back to where you were

Exemples

git bisect start HEAD v1.1.0

starts the search between the last release and now

git bisect run npm test

finds the first failing commit with no further input

git bisect reset

ends 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