2020-10-29 15:55:10 +01:00
title = Moving through time
cards = checkout commit-auto
2020-10-22 16:19:22 +02:00
2020-10-22 14:01:08 +02:00
[description]
2020-10-29 15:55:10 +01:00
The yellow boxes are frozen points in time, we call them "commits"! You can travel between them using the "checkout" card! (Try it!)
2020-10-22 14:01:08 +02:00
2020-10-29 15:55:10 +01:00
The grey panel below shows your current environment - click on an object to inspect or modify it! You can also click on commits to look at their contents.
2020-10-22 14:01:08 +02:00
2020-10-29 15:55:10 +01:00
Can you find out what happened here? Then, come back to the latest commit, and fix the problem, using the "commit" card!
2020-10-22 14:01:08 +02:00
[setup]
mkdir room1 room2
echo "A young girl with brown, curly hair." > room1/little_sister
echo "This piggy bank belongs to the big sister.
It contains 10 coins." > room2/piggy_bank
git add .
git commit -m "The beginning"
mv room1/little_sister room2
git add .
git commit -m "Little sister walks over"
echo "Has 10 coins." >> room2/little_sister
echo "This piggy bank belongs to the big sister.
It is empty." > room2/piggy_bank
git add .
git commit -m "Little sister does something"
mv room2/little_sister room1
git add .
git commit -m "Little sister walks back"
2020-10-29 15:55:10 +01:00
git checkout --detach
git branch -d main
2020-10-22 14:01:08 +02:00
[win]
2020-10-29 15:55:10 +01:00
{ git show HEAD:room2/piggy_bank | grep "10 coins"; } && { git show HEAD:room1/little_sister | grep -v "10 coins"; } && { git rev-parse HEAD^; }
2020-10-22 14:01:08 +02:00
[congrats]
Wonderful! Now that you're familiar with the time machine, let's look at some more complicated situations...
2020-10-22 17:27:54 +02:00
Click on "Next Level", as soon as you're ready!