oh-my-git/levels/time-machine/merge

92 lines
1.8 KiB
Text
Raw Permalink Normal View History

2020-10-22 16:19:22 +02:00
title = Merging timelines
2020-10-29 20:02:43 +01:00
cards = checkout commit-auto merge
2020-10-22 16:19:22 +02:00
[description]
2020-10-22 17:27:54 +02:00
Here's a trick so that you can sleep a bit longer: just do all your morning activities in parallel universes, and then at the end, merge them together!
Here, you see three parallel timelines - can you build a situation where you consumed a baguette, a coffee, *and* a donut?
2020-10-22 17:27:54 +02:00
The "merge" card will help you - try it!
[setup]
echo "A friendly old lady.
Sells delicious baguettes." > mary
echo "A rebellious teenager.
Sells good coffee." > larry
echo "A snail. Literally a snail.
Sells donuts with an unspecified, slimy filling." > gary
echo "You do not have a baguette.
You do not have coffee.
You do not have a donut." > you
git add .
git commit -m "The Beginning"
echo "You have a baguette.
You do not have coffee.
You do not have a donut." > you
git add .
git commit -m "You buy a baguette"
echo "You ate a baguette.
You do not have coffee.
You do not have a donut." > you
git add .
git commit -m "You eat the baguette"
git checkout HEAD~2
echo "You do not have a baguette.
You have coffee.
You do not have a donut." > you
git add .
git commit -m "You buy some coffee"
echo "You do not have a baguette.
You drank coffee.
You do not have a donut." > you
git add .
git commit -m "You drink the coffee"
git checkout HEAD~2
2020-10-22 17:27:54 +02:00
echo "You do not have a baguette.
You do not have coffee.
You have a donut." > you
git add .
git commit -m "You buy a donut"
echo "You do not have a baguette.
You do not have coffee.
You ate a donut." > you
2020-10-22 17:27:54 +02:00
git add .
2020-10-29 20:02:43 +01:00
git commit -m "You eat the donut"
2020-10-22 17:27:54 +02:00
git checkout HEAD~2
git branch -D main
[win]
2020-10-29 20:02:43 +01:00
{ git show HEAD:you | grep "You ate.*baguette"; } && { git show HEAD:you | grep "You drank.*coffee"; } && { git show HEAD:you | grep "You ate.*donut"; }
2020-10-22 17:27:54 +02:00
[congrats]
2020-10-29 20:02:43 +01:00
I wonder if you're more relaxed when you *sleep* in parallel timelines...