oh-my-git/levels/time-machine/bisect
2020-10-30 12:08:17 +01:00

43 lines
1.3 KiB
Plaintext

title = Yellow brick road
cards = checkout commit-auto reset-hard bisect-start bisect-good bisect-bad
[description]
(Please zoom out a bit using your mouse wheel! :D)
Oh no! You have lost your key at some point during the day!
Sure, you could look at every single commit in an attempt to find it - but there's a better way: your time machine has a built-in way to find the point in time where things went wrong quickly!
First, play the "bisect start" card. Then, go to a commit where you don't have the key, and play the "bisect bad" card. Likewise, go to a commit early on where you have the key, and play the "bisect good card".
After you've found the last good commit, reset the main branch to it. What happened to the key after you lost it?
[setup]
echo "You still have your key." > you
for i in {1..60}; do
if test $i -eq 18; then
echo "Your pocket is empty." > you
echo "Is on the ground." > key
fi
if test $i -eq 19; then
echo "Is holding a key in its beak." > bird
rm key
fi
if test $i -eq 20; then
rm bird
fi
git add .
git commit --allow-empty -m "$i"
done
[win]
test "$(git log --pretty=%s main | head -1)" -eq 17
[congrats]
Well done! :) The only problem is that you now have to walk all the way back home, again...