2021-01-13 16:26:48 +01:00
|
|
|
title = Make parallel commits
|
2020-10-29 15:55:10 +01:00
|
|
|
cards = checkout commit-auto
|
|
|
|
|
|
|
|
[description]
|
|
|
|
|
|
|
|
Did you know that creating parallel timelines is perfectly legal and safe? It's true!
|
|
|
|
|
2020-10-29 20:02:43 +01:00
|
|
|
Can you find out when things went wrong in this zoo, and create a parallel universe where everyone is happy?
|
2020-10-29 15:55:10 +01:00
|
|
|
|
|
|
|
[setup]
|
|
|
|
|
|
|
|
mkdir cage
|
|
|
|
echo "Looks very hungry." > cage/lion
|
|
|
|
|
|
|
|
echo "A small child.
|
|
|
|
It really loves cats!" > child
|
|
|
|
git add .
|
|
|
|
git commit -m "The beginning"
|
|
|
|
|
|
|
|
echo "It's holding a lollipop." >> child
|
|
|
|
git commit -am "The child buys something"
|
|
|
|
|
|
|
|
mv child cage
|
|
|
|
git add .
|
2020-10-29 20:02:43 +01:00
|
|
|
git commit -m "The child climbs somewhere"
|
2020-10-29 15:55:10 +01:00
|
|
|
|
|
|
|
git rm cage/child
|
|
|
|
echo "Looks happy. :)" > cage/lion
|
|
|
|
git add .
|
|
|
|
git commit -m "Oh no"
|
|
|
|
|
|
|
|
echo "It's sleeping." > cage/lion
|
|
|
|
git add .
|
|
|
|
git commit -m "Nap time!"
|
|
|
|
|
|
|
|
git checkout --detach
|
|
|
|
git branch -d main
|
|
|
|
|
|
|
|
[win]
|
|
|
|
|
2021-01-13 16:26:48 +01:00
|
|
|
# Make sure that the child is happy.
|
2020-12-22 12:13:40 +01:00
|
|
|
git ls-tree --name-only -r HEAD | grep child
|
|
|
|
|
2021-01-13 16:26:48 +01:00
|
|
|
# Make sure that the lion gets something to eat.
|
2020-12-22 12:13:40 +01:00
|
|
|
git show HEAD:cage/lion | grep -v "very hungry"
|
2020-10-29 15:55:10 +01:00
|
|
|
|
|
|
|
[congrats]
|
|
|
|
|
|
|
|
Whew, good job! This seems like a *much* better outcome.
|
|
|
|
|
|
|
|
Feel free to add more parallel timelines, or make them longer.
|
|
|
|
|
|
|
|
If you're ready, our next mission is already waiting...
|