Created
February 1, 2023 19:57
-
-
Save searls/5c6b77213dbc7202ca39f4e70d975eee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Useful when you want to git bisect in a rails app and know | |
# you need to `bin/rake db:migrate VERSION="SOMETHING"` before | |
# you check out the next commit so the database is in the right | |
# state, but you don't know what SOMETHING is. | |
# Usage: | |
# | |
# $ migration_version_at_ref <REF> | |
ref="$1" | |
git ls-tree --name-only "$ref:db/migrate" | tail -n 1 | cut -f 1 -d '_' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment