mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-12-20 20:33:11 +01:00
Enable files' drop area, two levels about the index
This commit is contained in:
parent
a893cba9d3
commit
8760ad7178
8 changed files with 87 additions and 6 deletions
|
@ -1,10 +1,13 @@
|
|||
conflict
|
||||
init
|
||||
checkout-commit
|
||||
branching
|
||||
merge
|
||||
branches
|
||||
conflict
|
||||
pull-push
|
||||
rebase
|
||||
reorder
|
||||
bisect
|
||||
steps
|
||||
split
|
||||
sandbox
|
||||
|
|
26
levels/time-machine/split
Normal file
26
levels/time-machine/split
Normal file
|
@ -0,0 +1,26 @@
|
|||
title = Split a commit!
|
||||
cards = checkout commit reset-hard reset add rebase-interactive rebase-continue show
|
||||
|
||||
[description]
|
||||
|
||||
Here, both changes happened in one commit! Split them to be in two commits instead.
|
||||
|
||||
[setup]
|
||||
|
||||
echo something > file1
|
||||
echo something else > file2
|
||||
git add .
|
||||
git commit -m "Initial commit"
|
||||
|
||||
echo this should happen first >> file1
|
||||
echo and this should happen after that >> file2
|
||||
git commit -am "Both together"
|
||||
|
||||
echo this is some other change >> file1
|
||||
echo this is some other change >> file2
|
||||
git commit -am "Something else"
|
||||
|
||||
[win]
|
||||
|
||||
test "$(git diff-tree --no-commit-id --name-status -r main^)" = "M file2" &&
|
||||
test "$(git diff-tree --no-commit-id --name-status -r main~2)" = "M file1"
|
23
levels/time-machine/steps
Normal file
23
levels/time-machine/steps
Normal file
|
@ -0,0 +1,23 @@
|
|||
title = One step after another
|
||||
cards = checkout commit reset-hard add
|
||||
|
||||
[description]
|
||||
|
||||
Sometimes, you might want to record the order in which things changed, instead of making a single commit.
|
||||
|
||||
What happened here? Make two commits from the changes (using the "add" card), in an order that makes sense!
|
||||
|
||||
[setup]
|
||||
|
||||
echo something > file1
|
||||
echo something else > file2
|
||||
git add .
|
||||
git commit -m "Initial commit"
|
||||
|
||||
echo this should happen first >> file1
|
||||
echo and this should happen after that >> file2
|
||||
|
||||
[win]
|
||||
|
||||
test "$(git diff-tree --no-commit-id --name-status -r main)" = "M file2" &&
|
||||
test "$(git diff-tree --no-commit-id --name-status -r main^)" = "M file1"
|
|
@ -39,11 +39,21 @@
|
|||
"command": "git rebase -i [commit]",
|
||||
"description": "Make changes to the events in your current timeline, back to the commit you drag this to."
|
||||
},
|
||||
{
|
||||
"id": "rebase-continue",
|
||||
"command": "git rebase --continue",
|
||||
"description": "Continue the current rebasing process."
|
||||
},
|
||||
{
|
||||
"id": "reset-hard",
|
||||
"command": "git reset --hard [commit]",
|
||||
"description": "Move the branch you're on to the specified commit."
|
||||
},
|
||||
{
|
||||
"id": "reset",
|
||||
"command": "git reset [commit]",
|
||||
"description": "Jump to the commit, and update the index. Keep the current environment."
|
||||
},
|
||||
{
|
||||
"id": "cherry-pick",
|
||||
"command": "git cherry-pick [commit]",
|
||||
|
@ -67,6 +77,16 @@
|
|||
{
|
||||
"id": "add",
|
||||
"command": "git add [file]",
|
||||
"description": ""
|
||||
"description": "Put the current status of the file into the plan."
|
||||
},
|
||||
{
|
||||
"id": "commit",
|
||||
"command": "git commit",
|
||||
"description": "Make a commit from the plan."
|
||||
},
|
||||
{
|
||||
"id": "show",
|
||||
"command": "git show [commit]",
|
||||
"description": "Show what changed in the commit."
|
||||
}
|
||||
]
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://scenes/file_browser_item.gd" type="Script" id=1]
|
||||
[ext_resource path="res://fonts/default.tres" type="DynamicFont" id=2]
|
||||
[ext_resource path="res://nodes/document.svg" type="Texture" id=3]
|
||||
[ext_resource path="res://scenes/drop_area.tscn" type="PackedScene" id=4]
|
||||
|
||||
[node name="Control" type="Control"]
|
||||
anchor_right = 0.104
|
||||
|
@ -79,3 +80,6 @@ custom_fonts/font = ExtResource( 2 )
|
|||
text = "filename"
|
||||
align = 1
|
||||
autowrap = true
|
||||
|
||||
[node name="DropArea" parent="." instance=ExtResource( 4 )]
|
||||
position = Vector2( 88.6643, 48.5029 )
|
||||
|
|
|
@ -21,7 +21,9 @@ func load(path):
|
|||
title = config.get("title", slug)
|
||||
description = config.get("description", "(no description)")
|
||||
congrats = config.get("congrats", "Good job, you solved the level!\n\nFeel free to try a few more things or click 'Next level'.")
|
||||
cards = Array(config.get("cards", "checkout commit-auto merge rebase rebase-interactive reset-hard cherry-pick add").split(" "))
|
||||
cards = Array(config.get("cards", "").split(" "))
|
||||
if cards == [""]:
|
||||
cards = []
|
||||
|
||||
var keys = config.keys()
|
||||
var repo_setups = []
|
||||
|
|
|
@ -65,7 +65,10 @@ func load_level(level_id):
|
|||
level_description.bbcode_text = level.description
|
||||
level_congrats.bbcode_text = level.congrats
|
||||
level_name.text = level.title
|
||||
cards.draw(levels.chapters[current_chapter].levels[current_level].cards)
|
||||
if levels.chapters[current_chapter].levels[current_level].cards.size() == 0:
|
||||
cards.redraw_all_cards()
|
||||
else:
|
||||
cards.draw(levels.chapters[current_chapter].levels[current_level].cards)
|
||||
|
||||
for r in repositories_node.get_children():
|
||||
r.queue_free()
|
||||
|
|
|
@ -197,7 +197,7 @@ margin_right = 633.0
|
|||
margin_bottom = 582.0
|
||||
size_flags_vertical = 3
|
||||
size_flags_stretch_ratio = 0.5
|
||||
title = "Next Commit:"
|
||||
title = "Plan for the next commit"
|
||||
mode = 2
|
||||
|
||||
[node name="FileBrowser" parent="Rows/Columns/RightSide" instance=ExtResource( 5 )]
|
||||
|
|
Loading…
Reference in a new issue