Fehlersuche mit git bisect
git bisect ist eine Binärsuche nach einem Commit, der ein Problem verursacht hat:
$ git bisect start
$ git bisect bad # Aktuelle Version funktioniert nicht
$ git bisect good v1.2.13 # In v1.2.13 ging es noch
Man bekommt den Commit in der Mitte zwischen [bad] und [good] und muss testen, ob das Problem auftritt oder nicht. So lange, bis nur noch ein Commit in Frage kommt:
Bisecting: 900 revisions left to test after this
$ git bisect good # ok, Bug tritt nicht auf
Bisecting: 450 revisions left to test after this
$ git bisect bad # Bug tritt auf
...
Historie kann angezeigt werden mit:
$ git bisect visualize
Wenn man auf einem ungünstigen Commit landet:
$ git reset --hard [rev]
Abbruch erfolgt mit:
$ git bisect reset