Reputation: 60689
If I start doing a git bisect, then the output of git status
will show me that I am currently bisecting. I would like to perform this “are you bisecting?” test in a script, I could look at the output of git status
, but I suspect there is a better way. git status --porcelain
doesn't include this bisecting status.
How can I robustly check in a script that a git bisect
is currently active?
git version 2.25
Upvotes: 5
Views: 119
Reputation: 487983
git bisect log
. This will produce output and/or errors, so redirect that away.Hence:
if git bisect log >/dev/null 2>&1; then
echo bisection is in progress
else
echo no bisection is in progress
fi
or:
if ! git bisect log >/dev/null 2>&1; then echo no bisection in progress; fi
(this is not documented but appears to be pretty reliable).
Upvotes: 2