mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2025-04-29 16:53:55 +02:00
Reorder levels and chapters into a better sequence
This commit is contained in:
parent
5c1f1ce722
commit
c99a35d54f
40 changed files with 128 additions and 288 deletions
47
levels/merge/conflict
Normal file
47
levels/merge/conflict
Normal file
|
@ -0,0 +1,47 @@
|
|||
title = Contradictions
|
||||
cards = checkout commit-auto merge reset-hard
|
||||
|
||||
[description]
|
||||
|
||||
Sometimes, timelines will contradict each other.
|
||||
|
||||
For example, in this case, one of our clients wants these timelines merged, but they ate different things for breakfast in both timelines.
|
||||
|
||||
Try to merge them together! You'll notice that there will be a conflict! The time machine will leave it up to you how to proceed: you can edit the problematic item, it will show you the conflicting sections. You can keep either of the two versions - or create a combination of them! Remove the >>>, <<<, and === markers, and make a new commit to finalize the merge!
|
||||
|
||||
Again, let your finalized timeline be the "main" one.
|
||||
|
||||
[setup]
|
||||
|
||||
echo "Just woke up. Is hungry." > sam
|
||||
git add .
|
||||
git commit -m "The beginning"
|
||||
|
||||
git checkout -b pancakes
|
||||
echo "Had blueberry pancakes with maple syrup for breakfast." > sam
|
||||
git add .
|
||||
git commit -m "Pancakes!"
|
||||
|
||||
echo "
|
||||
Is at work." >> sam
|
||||
git commit -am "Go to work"
|
||||
|
||||
git checkout -b muesli main
|
||||
echo "Had muesli with oats and strawberries for breakfast." > sam
|
||||
git add .
|
||||
git commit -m "Muesli!"
|
||||
|
||||
echo "
|
||||
Is at work." >> sam
|
||||
git commit -am "Go to work"
|
||||
|
||||
git checkout main
|
||||
|
||||
[win]
|
||||
|
||||
# main has a parent, and the grandparent of both its first and child parents are the same commit:
|
||||
git rev-parse main^ && test "$(git rev-parse main^1^^)" = "$(git rev-parse main^2^^)"
|
||||
|
||||
[congrats]
|
||||
|
||||
Yum, that sounds like a good breakfast!
|
91
levels/merge/merge
Normal file
91
levels/merge/merge
Normal file
|
@ -0,0 +1,91 @@
|
|||
title = Merging timelines
|
||||
cards = checkout commit-auto merge
|
||||
|
||||
[description]
|
||||
|
||||
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?
|
||||
|
||||
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
|
||||
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
|
||||
git add .
|
||||
git commit -m "You eat the donut"
|
||||
|
||||
git checkout HEAD~2
|
||||
git branch -D main
|
||||
|
||||
[win]
|
||||
|
||||
{ git show HEAD:you | grep "You ate.*baguette"; } && { git show HEAD:you | grep "You drank.*coffee"; } && { git show HEAD:you | grep "You ate.*donut"; }
|
||||
|
||||
[congrats]
|
||||
|
||||
I wonder if you're more relaxed when you *sleep* in parallel timelines...
|
Loading…
Add table
Add a link
Reference in a new issue