mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-03 19:04:40 +01:00
43 lines
1.3 KiB
Text
43 lines
1.3 KiB
Text
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 *in your pocket*, 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..30}; do
|
|
if test $i -eq 12; then
|
|
echo "Your pocket is empty." > you
|
|
echo "Is on the ground." > key
|
|
fi
|
|
if test $i -eq 13; then
|
|
echo "Is holding a key in its beak." > bird
|
|
rm key
|
|
fi
|
|
if test $i -eq 14; then
|
|
rm bird
|
|
fi
|
|
git add .
|
|
git commit --allow-empty -m "$i"
|
|
done
|
|
|
|
[win]
|
|
|
|
# Find the last good commit
|
|
test "$(git log --pretty=%s main | head -1)" -eq 11
|
|
|
|
[congrats]
|
|
|
|
Well done! :) The only problem is that you now have to walk all the way back home, again...
|