mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-20 16:20:18 +01:00
Polish levels some more
This commit is contained in:
parent
951ebd4c59
commit
7740c43a62
14 changed files with 97 additions and 50 deletions
|
@ -1,5 +1,5 @@
|
||||||
title = Branching out
|
title = Branching out
|
||||||
cards = checkout commit-auto reset-hard merge
|
cards = checkout commit-auto merge reset-hard
|
||||||
|
|
||||||
[description]
|
[description]
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ git checkout --detach main
|
||||||
|
|
||||||
[win]
|
[win]
|
||||||
|
|
||||||
{ git show main:you | grep "You ate a baguette"; } && { git show main:you | grep "You drank coffee"; } && { git show main:you | grep "You ate a donut"; }
|
{ git show main:you | grep "You ate.*baguette"; } && { git show main:you | grep "You drank.*coffee"; } && { git show main:you | grep "You ate.*donut"; }
|
||||||
|
|
||||||
[congrats]
|
[congrats]
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ cards = checkout commit-auto
|
||||||
|
|
||||||
Did you know that creating parallel timelines is perfectly legal and safe? It's true!
|
Did you know that creating parallel timelines is perfectly legal and safe? It's true!
|
||||||
|
|
||||||
Can you find out when things went wrong in this zoo, and create commits that tell a better story?
|
Can you find out when things went wrong in this zoo, and create a parallel universe where everyone is happy?
|
||||||
|
|
||||||
[setup]
|
[setup]
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ git commit -am "The child buys something"
|
||||||
|
|
||||||
mv child cage
|
mv child cage
|
||||||
git add .
|
git add .
|
||||||
git commit -m "The child is curious"
|
git commit -m "The child climbs somewhere"
|
||||||
|
|
||||||
git rm cage/child
|
git rm cage/child
|
||||||
echo "Looks happy. :)" > cage/lion
|
echo "Looks happy. :)" > cage/lion
|
||||||
|
|
|
@ -41,6 +41,4 @@ git branch -d main
|
||||||
|
|
||||||
[congrats]
|
[congrats]
|
||||||
|
|
||||||
Wonderful! Now that you're familiar with the time machine, let's look at some more complicated situations...
|
Wonderful! Now that you're getting familiar with the time machine, let's look at some more complicated situations...
|
||||||
|
|
||||||
Click on "Next Level", as soon as you're ready!
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
title = Contradictions
|
title = Contradictions
|
||||||
cards = checkout commit-auto reset-hard merge
|
cards = checkout commit-auto merge reset-hard
|
||||||
|
|
||||||
[description]
|
[description]
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ cards = init
|
||||||
|
|
||||||
Welcome, time agent! Good to see you - we could really use your help with fixing some temporal paradoxes!
|
Welcome, time agent! Good to see you - we could really use your help with fixing some temporal paradoxes!
|
||||||
|
|
||||||
Ready to initialize your time machine? Drag the `git init` card into the empty space!
|
Ready to initialize your time machine? Drag the `git init` card into the empty space above it!
|
||||||
|
|
||||||
[setup]
|
[setup]
|
||||||
|
|
||||||
|
@ -17,8 +17,8 @@ test -d .git
|
||||||
|
|
||||||
[congrats]
|
[congrats]
|
||||||
|
|
||||||
Oh hey, that's you! :) Wonderful!
|
Oh hey, that's you! :)
|
||||||
|
|
||||||
Now, let's make sure that your time machine works correctly...
|
The time machine can help you fix problems in the past! It allows you to collaborate with other time agents! It's really powerful, and it's really popular!
|
||||||
|
|
||||||
Click on "Next level", as soon as you're ready!
|
Let's get familiar with it! Click on "Next level", as soon as you're ready!
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
title = Merging timelines
|
title = Merging timelines
|
||||||
cards = checkout commit-auto reset-hard merge
|
cards = checkout commit-auto merge
|
||||||
|
|
||||||
[description]
|
[description]
|
||||||
|
|
||||||
|
@ -77,15 +77,15 @@ You do not have coffee.
|
||||||
|
|
||||||
You ate a donut." > you
|
You ate a donut." > you
|
||||||
git add .
|
git add .
|
||||||
git commit -m "You eat a donut"
|
git commit -m "You eat the donut"
|
||||||
|
|
||||||
git checkout HEAD~2
|
git checkout HEAD~2
|
||||||
git branch -D main
|
git branch -D main
|
||||||
|
|
||||||
[win]
|
[win]
|
||||||
|
|
||||||
{ git show HEAD:you | grep "You ate a baguette"; } && { git show HEAD:you | grep "You drank coffee"; } && { git show HEAD:you | grep "You ate a donut"; }
|
{ 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]
|
[congrats]
|
||||||
|
|
||||||
I wonder if you're more relaxed when you try to *sleep* in parallel timelines...
|
I wonder if you're more relaxed when you *sleep* in parallel timelines...
|
||||||
|
|
|
@ -7,23 +7,23 @@ The events and timelines you see are always only what your own time machine know
|
||||||
|
|
||||||
Of course, time agents don't have to work alone! Here, your sidekick has already prepared a merge for you! You can use the "pull" card to transfer it to your own time machine.
|
Of course, time agents don't have to work alone! Here, your sidekick has already prepared a merge for you! You can use the "pull" card to transfer it to your own time machine.
|
||||||
|
|
||||||
Then, add another event on top, and "push" the result, to transfer it back to your sidekick!
|
Then, add another event on top (what does Sam have for dinner?), and `push` the result, to transfer it back to your sidekick!
|
||||||
|
|
||||||
You can only ever manipulate things in your own time machine (the one on the right).
|
You can only ever manipulate things in your own time machine (the one on the bottom).
|
||||||
|
|
||||||
[setup yours]
|
[setup yours]
|
||||||
|
|
||||||
echo "Just woke up. Is hungry." > tom
|
echo "Just woke up. Is hungry." > sam
|
||||||
git add .
|
git add .
|
||||||
git commit -m "The beginning"
|
git commit -m "The beginning"
|
||||||
|
|
||||||
git checkout -b pancakes
|
git checkout -b pancakes
|
||||||
echo "Had blueberry pancakes with maple syrup for breakfast." > tom
|
echo "Had blueberry pancakes with maple syrup for breakfast." > sam
|
||||||
git add .
|
git add .
|
||||||
git commit -m "Pancakes!"
|
git commit -m "Pancakes!"
|
||||||
|
|
||||||
git checkout -b muesli main
|
git checkout -b muesli main
|
||||||
echo "Had muesli with oats and strawberries for breakfast." > tom
|
echo "Had muesli with oats and strawberries for breakfast." > sam
|
||||||
git add .
|
git add .
|
||||||
git commit -m "Muesli!"
|
git commit -m "Muesli!"
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ git checkout main
|
||||||
git merge pancakes
|
git merge pancakes
|
||||||
git merge muesli
|
git merge muesli
|
||||||
|
|
||||||
echo "Had pancakes with strawberries for breakfast." > tom
|
echo "Had pancakes with strawberries for breakfast." > sam
|
||||||
git add .
|
git add .
|
||||||
git commit -m "Let's make this breakfast compromise" --author="Sidekick <sidekick@example.com>"
|
git commit -m "Let's make this breakfast compromise" --author="Sidekick <sidekick@example.com>"
|
||||||
|
|
||||||
|
|
|
@ -5,22 +5,20 @@ cards = checkout commit-auto reset-hard rebase
|
||||||
|
|
||||||
Okay - turns out that saving time in the morning by utilizing parallel universes is against the regulations of the International Time Travel Association. You'll have to do your tasks in sequence after all.
|
Okay - turns out that saving time in the morning by utilizing parallel universes is against the regulations of the International Time Travel Association. You'll have to do your tasks in sequence after all.
|
||||||
|
|
||||||
See the "rebase" card? When you drag it to a commit, it will put the events in your current timeline on top of the specified one! This way, make a clean, linear timeline where you visit all three shops.
|
See the "rebase" card? When you drag it to a commit, it will copy the events in your current timeline after the specified one! This way, make a clean, linear timeline where you visit all three shops.
|
||||||
|
|
||||||
Again, we want to make that our base reality - the "main" tag should point to that timeline!
|
Again, we want to make that our base reality - the "main" branch should point to that timeline!
|
||||||
|
|
||||||
[setup]
|
[setup]
|
||||||
|
|
||||||
mkdir bakery coffee_shop donut_shop
|
|
||||||
|
|
||||||
echo "A friendly old lady.
|
echo "A friendly old lady.
|
||||||
Sells delicious baguettes for 5 coins each." > bakery/mary
|
Sells delicious baguettes." > mary
|
||||||
|
|
||||||
echo "A rebellious teenager.
|
echo "A rebellious teenager.
|
||||||
Sells good coffee for 2 coins each." > coffee_shop/larry
|
Sells good coffee." > larry
|
||||||
|
|
||||||
echo "A snail. Literally a snail.
|
echo "A snail. Literally a snail.
|
||||||
Sells donuts with an unspecified, slimy filling - for 3 coins each." > donut_shop/gary
|
Sells donuts with an unspecified, slimy filling." > gary
|
||||||
|
|
||||||
echo "You do not have a baguette.
|
echo "You do not have a baguette.
|
||||||
|
|
||||||
|
@ -31,31 +29,39 @@ You do not have a donut." > you
|
||||||
git add .
|
git add .
|
||||||
git commit -m "The Beginning"
|
git commit -m "The Beginning"
|
||||||
|
|
||||||
git checkout -b baguette
|
git checkout -b coffee
|
||||||
echo "You have a baguette.
|
echo "You have a baguette.
|
||||||
|
|
||||||
You do not have coffee.
|
You do not have coffee.
|
||||||
|
|
||||||
You do not have a donut." > you
|
You do not have a donut." > you
|
||||||
git mv you bakery
|
|
||||||
git add .
|
git add .
|
||||||
git commit -m "You get a baguette"
|
git commit -m "You buy a baguette"
|
||||||
git mv bakery/you .
|
|
||||||
git add .
|
|
||||||
git commit -m "You leave the bakery"
|
|
||||||
|
|
||||||
git checkout -b coffee main
|
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 -b baguette main
|
||||||
echo "You do not have a baguette.
|
echo "You do not have a baguette.
|
||||||
|
|
||||||
You have coffee.
|
You have coffee.
|
||||||
|
|
||||||
You do not have a donut." > you
|
You do not have a donut." > you
|
||||||
git mv you coffee_shop
|
|
||||||
git add .
|
git add .
|
||||||
git commit -m "You get some coffee"
|
git commit -m "You buy some coffee"
|
||||||
git mv coffee_shop/you .
|
|
||||||
|
echo "You do not have a baguette.
|
||||||
|
|
||||||
|
You drank coffee.
|
||||||
|
|
||||||
|
You do not have a donut." > you
|
||||||
git add .
|
git add .
|
||||||
git commit -m "You leave the coffee shop"
|
git commit -m "You drink the coffee"
|
||||||
|
|
||||||
git checkout -b donut main
|
git checkout -b donut main
|
||||||
echo "You do not have a baguette.
|
echo "You do not have a baguette.
|
||||||
|
@ -63,19 +69,26 @@ echo "You do not have a baguette.
|
||||||
You do not have coffee.
|
You do not have coffee.
|
||||||
|
|
||||||
You have a donut." > you
|
You have a donut." > you
|
||||||
git mv you donut_shop
|
|
||||||
git add .
|
git add .
|
||||||
git commit -m "You get a donut"
|
git commit -m "You buy a donut"
|
||||||
git mv donut_shop/you .
|
|
||||||
git add .
|
echo "You do not have a baguette.
|
||||||
git commit -m "You leave the donut shop"
|
|
||||||
|
You do not have coffee.
|
||||||
|
|
||||||
|
You ate a donut." > you
|
||||||
|
git add .
|
||||||
|
git commit -m "You eat the donut"
|
||||||
|
|
||||||
|
git checkout --detach main
|
||||||
|
|
||||||
git checkout baguette
|
|
||||||
|
|
||||||
[win]
|
[win]
|
||||||
|
|
||||||
{ git show main:you | grep "You have a baguette"; } && { git show main:you | grep "You have coffee"; } && { git show main:you | grep "You have a donut"; } && { test "$(git log main --oneline | wc -l)" -eq 7; }
|
{ git show main:you | grep "You ate.*baguette"; } && { git show main:you | grep "You drank.*coffee"; } && { git show main:you | grep "You ate.*donut"; } && { test "$(git log main --oneline | wc -l)" -eq 7; }
|
||||||
|
|
||||||
[congrats]
|
[congrats]
|
||||||
|
|
||||||
Notice how the other timelines and commits are still there - if anything goes wrong, you can also travel back to them.
|
Notice how the other timelines and commits are still there - if anything goes wrong, you can also travel back to them.
|
||||||
|
|
||||||
|
It's really hard to actually *destroy* stuff with your time machine.
|
||||||
|
|
|
@ -5,7 +5,7 @@ cards = checkout commit-auto reset-hard rebase-interactive cherry-pick
|
||||||
|
|
||||||
Oops, looks like there's something messed up here. Can you put the events back into their correct order?
|
Oops, looks like there's something messed up here. Can you put the events back into their correct order?
|
||||||
|
|
||||||
There are two ways to do this: You can drag the "interactive rebase" card to the commit before the one you want to change, and then reorder the lines in the file that opens.
|
There are two ways to do this: You can drag the "interactive rebase" card to the commit before the one you want to change, then reorder the lines in the file that opens, and save it.
|
||||||
|
|
||||||
Or you can reset the main tag to the very first commit, and then cherry-pick single commits in the order you want. You have cards for both approaches!
|
Or you can reset the main tag to the very first commit, and then cherry-pick single commits in the order you want. You have cards for both approaches!
|
||||||
|
|
||||||
|
|
25
levels/time-machine/sandbox
Normal file
25
levels/time-machine/sandbox
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
title = Sandbox
|
||||||
|
|
||||||
|
[description]
|
||||||
|
|
||||||
|
That's all for now! Here's a sandbox you can play around in.
|
||||||
|
|
||||||
|
Did you see the black terminal at the very bottom? All cards you play translate into actual commands, and there'a a real Git repo behind this! Fun things to try:
|
||||||
|
|
||||||
|
- Make a commit that merges three timelines together at once!
|
||||||
|
- Create some tags!
|
||||||
|
- Make a timeline that's completely independent of the rest!
|
||||||
|
|
||||||
|
[setup]
|
||||||
|
|
||||||
|
echo "You wake up." > you
|
||||||
|
git add .
|
||||||
|
git commit -m "The beginning"
|
||||||
|
|
||||||
|
echo "You drink coffee." >> you
|
||||||
|
git commit -am "First things first"
|
||||||
|
|
||||||
|
echo "You hear a knock on the door." >> you
|
||||||
|
git commit -am "Who's there?"
|
||||||
|
|
||||||
|
git branch not_main
|
|
@ -21,7 +21,7 @@
|
||||||
"id": "merge",
|
"id": "merge",
|
||||||
"command": "git merge",
|
"command": "git merge",
|
||||||
"arg_number": 1,
|
"arg_number": 1,
|
||||||
"description": "Merge the specified timeline into yours."
|
"description": "Merge the specified timeline into yours. If necessary, will create a merge commit."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "rebase",
|
"id": "rebase",
|
||||||
|
|
|
@ -13,6 +13,15 @@ __meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[node name="ColorRect" type="ColorRect" parent="."]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
mouse_filter = 2
|
||||||
|
color = Color( 0.105882, 0.137255, 0.211765, 1 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
[node name="Button" type="Button" parent="."]
|
[node name="Button" type="Button" parent="."]
|
||||||
visible = false
|
visible = false
|
||||||
anchor_left = 1.0
|
anchor_left = 1.0
|
||||||
|
|
|
@ -46,10 +46,12 @@ func update():
|
||||||
# The last entry is an empty string, remove it.
|
# The last entry is an empty string, remove it.
|
||||||
files.pop_back()
|
files.pop_back()
|
||||||
files.sort_custom(self, "very_best_sort")
|
files.sort_custom(self, "very_best_sort")
|
||||||
|
visible = false
|
||||||
for file_path in files:
|
for file_path in files:
|
||||||
file_path = file_path.substr(2)
|
file_path = file_path.substr(2)
|
||||||
if file_path.substr(0, 5) == ".git/":
|
if file_path.substr(0, 5) == ".git/":
|
||||||
continue
|
continue
|
||||||
|
visible = true
|
||||||
var item = preload("res://scenes/file_browser_item.tscn").instance()
|
var item = preload("res://scenes/file_browser_item.tscn").instance()
|
||||||
item.label = file_path
|
item.label = file_path
|
||||||
item.connect("clicked", self, "item_clicked")
|
item.connect("clicked", self, "item_clicked")
|
||||||
|
|
|
@ -18,7 +18,7 @@ func cd(dir):
|
||||||
# Run a shell command given as a string. Run this if you're interested in the
|
# Run a shell command given as a string. Run this if you're interested in the
|
||||||
# output of the command.
|
# output of the command.
|
||||||
func run(command, crash_on_fail=true):
|
func run(command, crash_on_fail=true):
|
||||||
var debug = false
|
var debug = true
|
||||||
|
|
||||||
if debug:
|
if debug:
|
||||||
print("$ %s" % command)
|
print("$ %s" % command)
|
||||||
|
|
Loading…
Reference in a new issue