Skip to content

Instantly share code, notes, and snippets.

@ayushdg
Last active October 10, 2019 22:24
Show Gist options
  • Save ayushdg/998b2af74aa4d928ab9f29ba4996dcdc to your computer and use it in GitHub Desktop.
Save ayushdg/998b2af74aa4d928ab9f29ba4996dcdc to your computer and use it in GitHub Desktop.
Steps to git-bisect

Git bisect to identify bad commit (here dask is used as an example)

Prerequisites to git bisect:

  • Know how to build dask from source
  • Known good commit eg: Dask version 2.4
  • Known bad commit eg: Dask version 2.5
  • Have a script/test that fails with bad commit but works with good commit
  • Ensure that the test indeed fails with dask built from source with bad commit and passes for dask built from source with good commit. (In the existing environment)

Git-bisect:

  1. $ git bisect start
  2. $ git bisect good <good-commit-hash>
  3. $ git bisect bad <bad-commit-hash>
  4. Git automatically chooses a commit between the good and bad state.
  5. Build dask
  6. Run the test
  7. Two possibilities:
  • If the test fails: $ git bisect bad
  • If the test passes: $ git bisect good
  1. Keep repeating steps 5-7 till you narrow down the specific commit that broke things
  2. $ git bisect reset to stop git bisect.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment