Git worktree - create branch in separate folder
Git bisect - search for the first bad commit
Bisecting may take a while and it makes repository “taken” so no work can be done in it until bisect
finished.
git worktree add -b branch-name <path>
cd <path>
git checkout <good-revision>
# run check to make sure it reports **PASS**
git checkout <bad-revision>
# run check to make sure it reports **FAIL**
git bisect start
git bisect good <good-revision>
git bisect bad <bad-revision>
git bisect run <check script>
git bisect reset
Verification script must return 0 for success, everything between 1 and 127
(inclusively) are treated as error. 125 has a special meaning, it skips commit.
Everythig else breaks the bisect
process.
rm -rf <path>
git worktree prune # cleans up `.git/worktrees
Using bisect
alone is the fastest way to find buggy commit. Adding worktree
to this workflow helps with time saving: you can continue your work while bisect
is looking for bugs for you. No more I should wait or N+ cloned repos.