Automated bisection checks out historical commits and executes their test scripts
Source references: 2The workflow tells Git to switch through multiple historical commits and run an npm test at each one. Package scripts in old revisions can execute arbitrary local commands just like current scripts, but the guidance does not require reviewing them or using isolation first.
If a tested commit contains malicious or no-longer-trusted scripts, bisection could expose available credentials, access the network, or alter user files. An interrupted bisect can also leave the worktree on a temporary historical revision.
The skill explicitly recommends checking out historical commits with `git bisect` and automatically running the repository's test command via `git bisect run`. If tests or npm lifecycle scripts in an old commit are untrusted, their code can execute on the user's machine. This section does not require script review or isolation. Users can ask the author to add a trusted-repository prerequisite, script inspection, and sandboxing.
```bash# Find which commit introduced the buggit bisect startgit bisect bad # Current commit is brokengit bisect good <known-good-sha> # This commit worked# Git will checkout midpoint commits; run your test at eachgit bisect run npm test -- --grep "failing test" # substitute the repository's focused-test command```Show 1 other places
**Use bisection for regression bugs:**```bash# Find which commit introduced the buggit bisect startgit bisect bad # Current commit is brokengit bisect good <known-good-sha> # This commit worked# Git will checkout midpoint commits; run your test at eachgit bisect run npm test -- --grep "failing test" # substitute the repository's focused-test command```