Skip to content

Instantly share code, notes, and snippets.

@searls
Created February 1, 2023 20:34
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save searls/91e05e21b54a095968b4bdaea9751b2e to your computer and use it in GitHub Desktop.
Save searls/91e05e21b54a095968b4bdaea9751b2e to your computer and use it in GitHub Desktop.
Used in conjunction with [this script](https://gist.github.com/searls/5c6b77213dbc7202ca39f4e70d975eee) to make it easier to git bisect rails apps whose database changes during the affected sha range
#!/usr/bin/env bash
# Usage:
#
# First, be sure you're running `git bisect start --no-checkout`, so you can
# checkout the bisect head yourself and do some pre-flight stuff like rewind
# migrations
#
# $ git bisect good
# Bisecting: 22 revisions left to test after this (roughly 5 steps)
# [8d85ccd2ce0fdbe3a1c3408f667b1cf15759c162] UI and validation tweaks
#
# $ rails_bisect_step
# pre-checkout
bin/rake db:migrate VERSION="$(migration_version_at_ref BISECT_HEAD)" 2>/dev/null || echo "No such migration"
git reset --hard
git checkout BISECT_HEAD
# post-checkout:
bin/rake db:migrate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment