高度な Git
Amanda Crawford-Adamo
Software and Data Engineer
バグを導入したコミットを二分探索で特定するツール
Git Bisect コマンド
git bisect
目的
git bisect セッションを開始
git bisect start
現在の状態を bad として設定
git bisect bad
直近の良い状態を指定
git bisect good <commit-hash>

現在のコミットを bad としてマーク
git bisect bad
現在のコミットを good としてマーク
git bisect good

自動テストスクリプトを実行して、そのコミットが良いか悪いかを判定します。
git bisect run <script_name>

Git Bisect 出力例
$ git log
b1a534f が最初の悪いコミットです
commit b1a534f89l2c3d4e5f6g7h8i9j0k1l2m3n4o5p
Author: Jane Doe <[email protected]>
Date: Thu Mar 14 14:30:00 2024 -0500
Update data transformation logic
git の bisection を終了し、現在の HEAD に戻ります
git bisect reset
ユースケース
ヒント
git bisect run <test-script> でテストを自動化高度な Git