diff --git a/levels/time-machine/branches b/levels/time-machine/branches index 6c8923e..facfcaa 100644 --- a/levels/time-machine/branches +++ b/levels/time-machine/branches @@ -1,5 +1,5 @@ title = Branching out -cards = checkout commit-auto reset-hard merge +cards = checkout commit-auto merge reset-hard [description] @@ -78,7 +78,7 @@ git checkout --detach main [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] diff --git a/levels/time-machine/branching b/levels/time-machine/branching index 2dd0df3..cb1968e 100644 --- a/levels/time-machine/branching +++ b/levels/time-machine/branching @@ -5,7 +5,7 @@ cards = checkout commit-auto 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] @@ -22,7 +22,7 @@ git commit -am "The child buys something" mv child cage git add . -git commit -m "The child is curious" +git commit -m "The child climbs somewhere" git rm cage/child echo "Looks happy. :)" > cage/lion diff --git a/levels/time-machine/checkout-commit b/levels/time-machine/checkout-commit index 3efd6f3..b2add87 100644 --- a/levels/time-machine/checkout-commit +++ b/levels/time-machine/checkout-commit @@ -41,6 +41,4 @@ git branch -d main [congrats] -Wonderful! Now that you're familiar with the time machine, let's look at some more complicated situations... - -Click on "Next Level", as soon as you're ready! +Wonderful! Now that you're getting familiar with the time machine, let's look at some more complicated situations... diff --git a/levels/time-machine/conflict b/levels/time-machine/conflict index e71746a..1db3fa5 100644 --- a/levels/time-machine/conflict +++ b/levels/time-machine/conflict @@ -1,5 +1,5 @@ title = Contradictions -cards = checkout commit-auto reset-hard merge +cards = checkout commit-auto merge reset-hard [description] diff --git a/levels/time-machine/init b/levels/time-machine/init index e953352..463652b 100644 --- a/levels/time-machine/init +++ b/levels/time-machine/init @@ -5,7 +5,7 @@ cards = init 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] @@ -17,8 +17,8 @@ test -d .git [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! diff --git a/levels/time-machine/merge b/levels/time-machine/merge index db3344d..5b7b014 100644 --- a/levels/time-machine/merge +++ b/levels/time-machine/merge @@ -1,5 +1,5 @@ title = Merging timelines -cards = checkout commit-auto reset-hard merge +cards = checkout commit-auto merge [description] @@ -77,15 +77,15 @@ You do not have coffee. You ate a donut." > you git add . -git commit -m "You eat a donut" +git commit -m "You eat the donut" git checkout HEAD~2 git branch -D main [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] -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... diff --git a/levels/time-machine/pull-push b/levels/time-machine/pull-push index de32a51..71ce61d 100644 --- a/levels/time-machine/pull-push +++ b/levels/time-machine/pull-push @@ -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. -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] -echo "Just woke up. Is hungry." > tom +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." > tom +echo "Had blueberry pancakes with maple syrup for breakfast." > sam git add . git commit -m "Pancakes!" 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 commit -m "Muesli!" @@ -37,7 +37,7 @@ git checkout main git merge pancakes git merge muesli -echo "Had pancakes with strawberries for breakfast." > tom +echo "Had pancakes with strawberries for breakfast." > sam git add . git commit -m "Let's make this breakfast compromise" --author="Sidekick " diff --git a/levels/time-machine/rebase b/levels/time-machine/rebase index d37b290..c755962 100644 --- a/levels/time-machine/rebase +++ b/levels/time-machine/rebase @@ -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. -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] -mkdir bakery coffee_shop donut_shop - echo "A friendly old lady. -Sells delicious baguettes for 5 coins each." > bakery/mary +Sells delicious baguettes." > mary echo "A rebellious teenager. -Sells good coffee for 2 coins each." > coffee_shop/larry +Sells good coffee." > larry 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. @@ -31,31 +29,39 @@ You do not have a donut." > you git add . git commit -m "The Beginning" -git checkout -b baguette +git checkout -b coffee echo "You have a baguette. You do not have coffee. You do not have a donut." > you -git mv you bakery git add . -git commit -m "You get a baguette" -git mv bakery/you . -git add . -git commit -m "You leave the bakery" +git commit -m "You buy a baguette" -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. You have coffee. You do not have a donut." > you -git mv you coffee_shop git add . -git commit -m "You get some coffee" -git mv coffee_shop/you . +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 leave the coffee shop" +git commit -m "You drink the coffee" git checkout -b donut main echo "You do not have a baguette. @@ -63,19 +69,26 @@ echo "You do not have a baguette. You do not have coffee. You have a donut." > you -git mv you donut_shop git add . -git commit -m "You get a donut" -git mv donut_shop/you . -git add . -git commit -m "You leave the donut shop" +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 --detach main -git checkout baguette [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] 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. diff --git a/levels/time-machine/reorder b/levels/time-machine/reorder index 1175df3..1d869f8 100644 --- a/levels/time-machine/reorder +++ b/levels/time-machine/reorder @@ -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? -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! diff --git a/levels/time-machine/sandbox b/levels/time-machine/sandbox new file mode 100644 index 0000000..6879338 --- /dev/null +++ b/levels/time-machine/sandbox @@ -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 diff --git a/resources/cards.json b/resources/cards.json index 9cac851..61aeea9 100644 --- a/resources/cards.json +++ b/resources/cards.json @@ -21,7 +21,7 @@ "id": "merge", "command": "git merge", "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", diff --git a/scenes/cards.tscn b/scenes/cards.tscn index 3959b10..1fc2fcc 100644 --- a/scenes/cards.tscn +++ b/scenes/cards.tscn @@ -13,6 +13,15 @@ __meta__ = { "_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="."] visible = false anchor_left = 1.0 diff --git a/scenes/file_browser.gd b/scenes/file_browser.gd index 9f8a156..2251ed5 100644 --- a/scenes/file_browser.gd +++ b/scenes/file_browser.gd @@ -46,10 +46,12 @@ func update(): # The last entry is an empty string, remove it. files.pop_back() files.sort_custom(self, "very_best_sort") + visible = false for file_path in files: file_path = file_path.substr(2) if file_path.substr(0, 5) == ".git/": continue + visible = true var item = preload("res://scenes/file_browser_item.tscn").instance() item.label = file_path item.connect("clicked", self, "item_clicked") diff --git a/scenes/shell.gd b/scenes/shell.gd index be1cc53..3a00b03 100644 --- a/scenes/shell.gd +++ b/scenes/shell.gd @@ -18,7 +18,7 @@ func cd(dir): # Run a shell command given as a string. Run this if you're interested in the # output of the command. func run(command, crash_on_fail=true): - var debug = false + var debug = true if debug: print("$ %s" % command)