Skip to content

Instantly share code, notes, and snippets.

@nzbart
Last active March 22, 2023 02:19
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nzbart/2002a1d472cfecfebb3112f1a84be48a to your computer and use it in GitHub Desktop.
Save nzbart/2002a1d472cfecfebb3112f1a84be48a to your computer and use it in GitHub Desktop.
How to use `git bisect run` with a PowerShell script to reproduce an issue, for example a test that has started failing recently.
powershell -command %~dpn0.ps1
# Do some tests e.g. run nunit3-console.exe as below
#cd <REPOSITORY DIRECTORY>
#msbuild <SOLUTION PATH>
#<NUNIT DIRECTORY>\nunit3-console.exe <ASSEMBLY PATH> --test="<FULLY QUALIFIED TEST METHOD>"
exit $lastexitcode

Start the bisect operation in the root of your repository:

git bisect start HEAD origin/master #for a bug that was not present in master, but is now

Start the bisection process:

git bisect run Repro.cmd   #probably best to hard-code the location of Repro.ps1, outside the repository
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment