git bisect start
git bisect good
git bisect bad `git rev-list --max-parents=0 HEAD`
git bisect run ./test.sh
Or incorporate these commands into an alias, e.g.:
bisect-all = !git bisect start && git bisect bad &&\
git bisect good `git rev-list --max-parents=0 --first-parent HEAD`
And then just use git bisect-all
, git bisect run ./test.sh
.
Creating an alias to handle the whole process is slightly more complicated:
quick-bisect = !sh -c 'git bisect start && git bisect bad &&\
git bisect good `git rev-list --max-parents=0 --first-parent HEAD` &&\
git bisect run "$@" && git bisect reset' -
But with that, you can simply run git quick-bisect ./test.sh
.
If you're using a version of git older than 1.7.4.2, you won't have the --max-parents
option, so will need to use something like git rev-list HEAD | tail -n 1
instead.
--first-parent
to the rev-list to avoid multiple-root trouble when e.g. projects get merged, and quote the params, "$@", to avoid unwanted word splitting? – Heinrike