mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-12-22 20:32:38 +01:00
Polish branches chapter
This commit is contained in:
parent
80c50bdc81
commit
be45b82e41
18 changed files with 231 additions and 191 deletions
|
@ -1,35 +1,40 @@
|
||||||
title = Party Time
|
title = Creating branches
|
||||||
cards = checkout commit-auto reset-hard branch
|
cards = checkout commit-auto branch branch-delete reset-hard
|
||||||
|
|
||||||
[description]
|
[description]
|
||||||
|
|
||||||
You were invited to two parties but they will happen at the same time! At party 1 your favorite band is playing and the other one is your best friend's birthday party.
|
You were invited to two parties! At one of them, your favorite band is playing - and the other one is your best friend's birthday party. Where should you go? No worries - as a time travel agent in training, you can go to both parties!
|
||||||
|
|
||||||
Where should you go? No worries - you are a time travel agent in training. You can go to both parties! To quickly switch between both events, check out the last commits and
|
To make it easier to tell which timeline is which, you can create time portals! (We call these "branches".)
|
||||||
create branches with the `git branch [string]` command. Now you can easily switch between both branches by calling `git checkout [branch]`.
|
|
||||||
|
|
||||||
[setup]
|
[setup]
|
||||||
|
|
||||||
echo "-Birthday present.
|
echo "You wrap the birthday present, and grab your concert ticket." > you
|
||||||
-Concert ticket." > backpack
|
|
||||||
git add .
|
git add .
|
||||||
git commit -m "evening preparations"
|
git commit -m "Evening preparations"
|
||||||
echo "-Birthday present." > backpack
|
echo "You go to the birthday party!" >> you
|
||||||
git add .
|
git add .
|
||||||
git commit -m "go to the birthday"
|
git commit -m "Go to the birthday"
|
||||||
|
|
||||||
git checkout HEAD~1
|
git checkout HEAD~1
|
||||||
echo "-Concert ticket." > backpack
|
echo "You go to the concert!" > you
|
||||||
git add .
|
git add .
|
||||||
git commit -m "go to the concert"
|
git commit -m "Go to the concert"
|
||||||
|
|
||||||
git checkout HEAD~1
|
git checkout HEAD~1
|
||||||
|
|
||||||
|
git branch -D main
|
||||||
|
|
||||||
[win]
|
[win]
|
||||||
|
|
||||||
NUM_BRANCHES="$(git show-ref --heads | wc -l)"
|
# Create a branch called 'birthday' that points to the birthday timeline.
|
||||||
test "$NUM_BRANCHES" -ge 3
|
git show birthday | grep 'to the birthday'
|
||||||
|
|
||||||
|
# Create a branch called 'concert' that points to the concert timeline.
|
||||||
|
git show concert | grep 'to the concert'
|
||||||
|
|
||||||
[congrats]
|
[congrats]
|
||||||
|
|
||||||
|
Now you can travel between those branches easily (using `git checkout`) - try it!
|
||||||
|
|
||||||
Your friend is happy that you made it to the birthday party and you also got your concert ticket signed. Yay!
|
Your friend is happy that you made it to the birthday party and you also got your concert ticket signed. Yay!
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
title = Choose your own adventure
|
title = Deleting branches
|
||||||
cards = checkout commit-auto reset-hard branch-delete
|
cards = checkout commit-auto reset-hard branch-delete
|
||||||
|
|
||||||
[description]
|
[description]
|
||||||
|
@ -7,8 +7,6 @@ Life is full of dangers, right? Even when walking to school, it seems like there
|
||||||
|
|
||||||
This Monday is especially bad. You made it to school, but there's some timelines you definitely don't want to keep around.
|
This Monday is especially bad. You made it to school, but there's some timelines you definitely don't want to keep around.
|
||||||
|
|
||||||
Find the bad branches and delete them. Keep the one that seems okay.
|
|
||||||
|
|
||||||
[setup]
|
[setup]
|
||||||
|
|
||||||
echo You leave your house and start walking to school. > you
|
echo You leave your house and start walking to school. > you
|
||||||
|
@ -33,14 +31,16 @@ echo Because you\'re kind of late, you start running. Someone throws a piano out
|
||||||
git commit -am "Sounds nice"
|
git commit -am "Sounds nice"
|
||||||
|
|
||||||
git checkout HEAD^ -b ice-cream
|
git checkout HEAD^ -b ice-cream
|
||||||
echo You\'re not in a hurry, and walk slowly. You even get some ice cream on your way. You arrive at school too late, and your teacher is angry. >> you
|
echo You\'re not in a hurry, and walk slowly. You even get some ice cream on your way. You arrive at school too late, your teacher is angry, and you are expelled. >> you
|
||||||
git commit -am "Yum"
|
git commit -am "Yum"
|
||||||
|
|
||||||
git checkout main
|
git branch -M main leap
|
||||||
|
git checkout leap^^
|
||||||
|
|
||||||
[win]
|
[win]
|
||||||
|
|
||||||
test "$(git branch | cut -c 3-)" = "$(echo -e ice-cream\\nmain)"
|
# Find the bad branches and delete them. Keep the best one.
|
||||||
|
test "$(git show-ref --heads | cut -f2 -d' ')" = "$(echo refs/heads/leap)"
|
||||||
|
|
||||||
[congrats]
|
[congrats]
|
||||||
|
|
||||||
|
|
|
@ -1,103 +0,0 @@
|
||||||
title = Branching out
|
|
||||||
cards = checkout commit-auto merge reset-hard
|
|
||||||
|
|
||||||
[description]
|
|
||||||
|
|
||||||
You can use these little blue labels to give names to different timelines! This makes it easier to remember what happened where.
|
|
||||||
|
|
||||||
One of your colleagues messed up here - can you help reordering the branches correctly using the "reset" card?
|
|
||||||
|
|
||||||
When you do commits or merges while you're on a branch, the branch will grow with you. Try that while you eat that donut.
|
|
||||||
|
|
||||||
Finally, merge all timelines together, in a way so that the "main" branch points to the result. That's base reality!
|
|
||||||
|
|
||||||
---
|
|
||||||
tipp1
|
|
||||||
---
|
|
||||||
tipp2
|
|
||||||
---
|
|
||||||
tipp3
|
|
||||||
|
|
||||||
[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"
|
|
||||||
|
|
||||||
git checkout -b coffee
|
|
||||||
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 -b baguette main
|
|
||||||
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 -b donut main
|
|
||||||
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"
|
|
||||||
|
|
||||||
git checkout --detach main
|
|
||||||
|
|
||||||
[win]
|
|
||||||
|
|
||||||
# Did you eat a baguette on the main branch?
|
|
||||||
git show main:you | grep "You ate.*baguette"
|
|
||||||
|
|
||||||
# Did you drink a coffee on the main branch?
|
|
||||||
git show main:you | grep "You drank.*coffee"
|
|
||||||
|
|
||||||
# Did you eat a donut on the main branch?
|
|
||||||
git show main:you | grep "You ate.*donut"
|
|
||||||
|
|
||||||
[actions]
|
|
||||||
|
|
||||||
test "$(git rev-parse HEAD^)" = "$(git rev-parse donut)" && hint "Ooops, your branch ref is still on the old commit."
|
|
||||||
|
|
||||||
[congrats]
|
|
||||||
|
|
||||||
Nice! It's often convenient to stay on branches most of the time!
|
|
39
levels/branches/checkout-commit
Normal file
39
levels/branches/checkout-commit
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
title = Moving through time
|
||||||
|
cards = checkout commit-auto
|
||||||
|
|
||||||
|
[description]
|
||||||
|
|
||||||
|
The yellow boxes are frozen points in time, we call them "commits"! You can travel between them using the "checkout" card! (Try it!)
|
||||||
|
|
||||||
|
The grey panel below shows your current environment - click on an object to inspect or modify it!
|
||||||
|
|
||||||
|
Can you find out what happened here? Then, while on the latest commit, fix the problem, and make a new commit!
|
||||||
|
|
||||||
|
[setup]
|
||||||
|
|
||||||
|
echo "This piggy bank belongs to the big sister.
|
||||||
|
It contains 10 coins." > piggy_bank
|
||||||
|
git add .
|
||||||
|
git commit -m "The beginning"
|
||||||
|
|
||||||
|
echo "A young girl with brown, curly hair." > little_sister
|
||||||
|
git add .
|
||||||
|
git commit -m "Little sister comes in"
|
||||||
|
|
||||||
|
echo "Has 10 coins." >> little_sister
|
||||||
|
echo "This piggy bank belongs to the big sister.
|
||||||
|
It is empty." > piggy_bank
|
||||||
|
git add .
|
||||||
|
git commit -m "Little sister does something"
|
||||||
|
|
||||||
|
git checkout HEAD^^
|
||||||
|
git branch -df main
|
||||||
|
|
||||||
|
[win]
|
||||||
|
|
||||||
|
# Restore sisterly peace.
|
||||||
|
{ git show HEAD:piggy_bank | grep "10 coins"; } && { git show HEAD:little_sister | grep -v "10 coins"; } && { git rev-parse HEAD^^^; }
|
||||||
|
|
||||||
|
[congrats]
|
||||||
|
|
||||||
|
Wonderful! Now that you're getting familiar with the time machine, let's look at some more complicated situations...
|
|
@ -1,4 +1,4 @@
|
||||||
title = Parallelism
|
title = Make parallel commits
|
||||||
cards = checkout commit-auto
|
cards = checkout commit-auto
|
||||||
|
|
||||||
[description]
|
[description]
|
||||||
|
@ -38,10 +38,10 @@ git branch -d main
|
||||||
|
|
||||||
[win]
|
[win]
|
||||||
|
|
||||||
# Is the child still there?
|
# Make sure that the child is happy.
|
||||||
git ls-tree --name-only -r HEAD | grep child
|
git ls-tree --name-only -r HEAD | grep child
|
||||||
|
|
||||||
# Is the lion not hungry?
|
# Make sure that the lion gets something to eat.
|
||||||
git show HEAD:cage/lion | grep -v "very hungry"
|
git show HEAD:cage/lion | grep -v "very hungry"
|
||||||
|
|
||||||
[congrats]
|
[congrats]
|
45
levels/branches/grow
Normal file
45
levels/branches/grow
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
title = Branches grow with you!
|
||||||
|
cards = checkout commit-auto branch branch-delete reset-hard
|
||||||
|
|
||||||
|
[description]
|
||||||
|
|
||||||
|
Note that there are two options to "travel to the end of a timeline":
|
||||||
|
|
||||||
|
First, you can directly travel to the commit, like we've done it before.
|
||||||
|
|
||||||
|
And second, you can travel to the branch label. In this case, when you make a new commit, the branch will grow with you, and still point at the end of the timeline, which is usually what we want!
|
||||||
|
|
||||||
|
Let's try both of these!
|
||||||
|
|
||||||
|
[setup]
|
||||||
|
|
||||||
|
echo "You wrap the birthday present, and grab your concert ticket." > you
|
||||||
|
git add .
|
||||||
|
git commit -m "Evening preparations"
|
||||||
|
echo "You go to the birthday party!" >> you
|
||||||
|
git add .
|
||||||
|
git commit -m "Go to the birthday"
|
||||||
|
git branch birthday
|
||||||
|
|
||||||
|
git checkout HEAD~1
|
||||||
|
echo "You go to the concert!" > you
|
||||||
|
git add .
|
||||||
|
git commit -m "Go to the concert"
|
||||||
|
git branch concert
|
||||||
|
|
||||||
|
git checkout HEAD~1
|
||||||
|
|
||||||
|
git branch -D main
|
||||||
|
|
||||||
|
[win]
|
||||||
|
|
||||||
|
# Travel directly to the last commit of the birthday timeline, make a change to 'you', and make a commit
|
||||||
|
for commit in $(git cat-file --batch-check='%(objectname) %(objecttype)' --batch-all-objects | grep 'commit$' | cut -f1 -d' '); do
|
||||||
|
if test $(git rev-parse $commit^) = $(git rev-parse birthday); then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return 1
|
||||||
|
|
||||||
|
# Travel to the 'concert' branch, make a change to 'you', and a commit.
|
||||||
|
git show concert^ | grep "Go to the concert"
|
81
levels/branches/reorder
Normal file
81
levels/branches/reorder
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
title = Moving branches around
|
||||||
|
cards = checkout commit-auto merge reset-hard
|
||||||
|
|
||||||
|
[description]
|
||||||
|
|
||||||
|
One of your colleagues messed up here, and put the branches in the wrong timelines!
|
||||||
|
|
||||||
|
You could delete and re-create these branches - but you can also directly move them to different commits, using `git reset --hard`.
|
||||||
|
|
||||||
|
The donut branch is in the right place, but the timeline is still incomplete.
|
||||||
|
|
||||||
|
[setup]
|
||||||
|
|
||||||
|
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"
|
||||||
|
|
||||||
|
git checkout -b coffee
|
||||||
|
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 -b baguette main
|
||||||
|
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 -b donut main
|
||||||
|
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"
|
||||||
|
|
||||||
|
git checkout --detach main
|
||||||
|
|
||||||
|
[win]
|
||||||
|
|
||||||
|
# Did you eat a baguette on the baguette branch?
|
||||||
|
git show baguette:you | grep "You ate.*baguette"
|
||||||
|
|
||||||
|
# Did you drink a coffee on the coffee branch?
|
||||||
|
git show coffee:you | grep "You drank.*coffee"
|
||||||
|
|
||||||
|
# Did you eat a donut on the donut branch?
|
||||||
|
git show donut:you | grep "You ate.*donut"
|
||||||
|
|
||||||
|
[actions]
|
||||||
|
|
||||||
|
test "$(git rev-parse HEAD^)" = "$(git rev-parse donut)" && hint "Remember to checkout the blue branch tag when you want it to grow with the timeline."
|
6
levels/branches/sequence
Normal file
6
levels/branches/sequence
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
checkout-commit
|
||||||
|
fork
|
||||||
|
branch-create
|
||||||
|
grow
|
||||||
|
branch-remove
|
||||||
|
reorder
|
|
@ -9,7 +9,7 @@ For example, in this case, one of our clients wants these timelines merged, but
|
||||||
|
|
||||||
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!
|
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.
|
Let your finalized timeline be the "main" one.
|
||||||
|
|
||||||
[setup]
|
[setup]
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ git checkout main
|
||||||
|
|
||||||
[win]
|
[win]
|
||||||
|
|
||||||
# main has a parent, and the grandparent of both its first and child parents are the same commit:
|
# Make a breakfast compromise in the 'main' branch.
|
||||||
git rev-parse main^ && test "$(git rev-parse main^1^^)" = "$(git rev-parse main^2^^)"
|
git rev-parse main^ && test "$(git rev-parse main^1^^)" = "$(git rev-parse main^2^^)"
|
||||||
|
|
||||||
[congrats]
|
[congrats]
|
||||||
|
|
|
@ -5,10 +5,6 @@ cards = checkout commit-auto merge
|
||||||
|
|
||||||
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'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]
|
[setup]
|
||||||
|
|
||||||
echo "A friendly old lady.
|
echo "A friendly old lady.
|
||||||
|
@ -79,11 +75,12 @@ You ate a donut." > you
|
||||||
git add .
|
git add .
|
||||||
git commit -m "You eat the donut"
|
git commit -m "You eat the donut"
|
||||||
|
|
||||||
git checkout HEAD~2
|
git checkout --detach
|
||||||
git branch -D main
|
git branch -D main
|
||||||
|
|
||||||
[win]
|
[win]
|
||||||
|
|
||||||
|
# Build a situation where you consumed a baguette, a coffee, *and* 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"; }
|
{ 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]
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
title = Merging timelines
|
title = Abort a merge
|
||||||
cards = checkout commit-auto merge
|
cards = checkout commit-auto merge merge-abort
|
||||||
|
|
||||||
[description]
|
[description]
|
||||||
|
|
||||||
Sometimes you want to merge two commits, nut a merge conflict occurs that you currently don't want to resolve.
|
Sometimes you want to merge two commits, but a merge conflict occurs that you currently don't want to resolve.
|
||||||
|
|
||||||
In these situations you can abort the merge to merge later. Use
|
In these situations you can abort the merge to merge later. Use
|
||||||
git merge --abort
|
git merge --abort
|
||||||
when you are in a merge process.
|
when you are in a merge process.
|
||||||
|
@ -46,7 +47,7 @@ fi
|
||||||
test -f .git/secretfile
|
test -f .git/secretfile
|
||||||
|
|
||||||
# You aborted to merge?
|
# You aborted to merge?
|
||||||
test -f .git/secretfile && ! test -f .git/MERGE_HEAD
|
test -f .git/secretfile && ! test -f .git/MERGE_HEAD && ! git rev-parse HEAD^^
|
||||||
|
|
||||||
[congrats]
|
[congrats]
|
||||||
|
|
||||||
|
|
3
levels/merge/sequence
Normal file
3
levels/merge/sequence
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
merge
|
||||||
|
conflict
|
||||||
|
merge-abort
|
|
@ -1,10 +1,10 @@
|
||||||
intro
|
intro
|
||||||
files
|
files
|
||||||
index
|
|
||||||
branches
|
branches
|
||||||
merge
|
merge
|
||||||
tags
|
|
||||||
remotes
|
remotes
|
||||||
|
index
|
||||||
|
tags
|
||||||
changing-the-past
|
changing-the-past
|
||||||
shit-happens
|
shit-happens
|
||||||
stash
|
stash
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
title = Moving through time
|
|
||||||
cards = checkout commit-auto
|
|
||||||
|
|
||||||
[description]
|
|
||||||
|
|
||||||
The yellow boxes are frozen points in time, we call them "commits"! You can travel between them using the "checkout" card! (Try it!)
|
|
||||||
|
|
||||||
The grey panel below shows your current environment - click on an object to inspect or modify it!
|
|
||||||
|
|
||||||
Can you find out what happened here? Then, come back to the latest commit, and fix the problem, using the "commit" card!
|
|
||||||
|
|
||||||
[setup]
|
|
||||||
|
|
||||||
mkdir room1 room2
|
|
||||||
echo "A young girl with brown, curly hair." > room1/little_sister
|
|
||||||
echo "This piggy bank belongs to the big sister.
|
|
||||||
It contains 10 coins." > room2/piggy_bank
|
|
||||||
git add .
|
|
||||||
git commit -m "The beginning"
|
|
||||||
|
|
||||||
mv room1/little_sister room2
|
|
||||||
git add .
|
|
||||||
git commit -m "Little sister walks over"
|
|
||||||
|
|
||||||
echo "Has 10 coins." >> room2/little_sister
|
|
||||||
echo "This piggy bank belongs to the big sister.
|
|
||||||
It is empty." > room2/piggy_bank
|
|
||||||
git add .
|
|
||||||
git commit -m "Little sister does something"
|
|
||||||
|
|
||||||
mv room2/little_sister room1
|
|
||||||
git add .
|
|
||||||
git commit -m "Little sister walks back"
|
|
||||||
|
|
||||||
git checkout --detach
|
|
||||||
git branch -d main
|
|
||||||
|
|
||||||
[win]
|
|
||||||
|
|
||||||
{ git show HEAD:room2/piggy_bank | grep "10 coins"; } && { git show HEAD:room1/little_sister | grep -v "10 coins"; } && { git rev-parse HEAD^; }
|
|
||||||
|
|
||||||
[congrats]
|
|
||||||
|
|
||||||
Wonderful! Now that you're getting familiar with the time machine, let's look at some more complicated situations...
|
|
|
@ -46,9 +46,14 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "merge",
|
"id": "merge",
|
||||||
"command": "git merge [commit]",
|
"command": "git merge [commit, ref]",
|
||||||
"description": "Merge the specified timeline into yours. If necessary, will create a merge commit."
|
"description": "Merge the specified timeline into yours. If necessary, will create a merge commit."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "merge-abort",
|
||||||
|
"command": "git merge --abort",
|
||||||
|
"description": "Abort the current merge attempt, and reconstruct the previous state."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "rebase",
|
"id": "rebase",
|
||||||
"command": "git rebase [commit]",
|
"command": "git rebase [commit]",
|
||||||
|
@ -137,7 +142,7 @@
|
||||||
{
|
{
|
||||||
"id": "branch",
|
"id": "branch",
|
||||||
"command": "git branch [string]",
|
"command": "git branch [string]",
|
||||||
"description": "Create a new branch."
|
"description": "Create a new branch at your current location."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "branch-delete",
|
"id": "branch-delete",
|
||||||
|
|
|
@ -102,7 +102,7 @@ func load_level(level_id):
|
||||||
terminal.clear()
|
terminal.clear()
|
||||||
terminal.find_node("TextEditor").close()
|
terminal.find_node("TextEditor").close()
|
||||||
|
|
||||||
#update_repos()
|
update_repos()
|
||||||
|
|
||||||
# Unmute the audio after a while, so that player can hear pop sounds for
|
# Unmute the audio after a while, so that player can hear pop sounds for
|
||||||
# nodes they create.
|
# nodes they create.
|
||||||
|
|
|
@ -188,7 +188,7 @@ __meta__ = {
|
||||||
[node name="Text" type="Control" parent="Rows/Columns/RightSide/LevelInfo/LevelPanel"]
|
[node name="Text" type="Control" parent="Rows/Columns/RightSide/LevelInfo/LevelPanel"]
|
||||||
margin_top = 65.0
|
margin_top = 65.0
|
||||||
margin_right = 633.0
|
margin_right = 633.0
|
||||||
margin_bottom = 264.0
|
margin_bottom = 464.0
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
|
|
||||||
[node name="LevelDescription" type="RichTextLabel" parent="Rows/Columns/RightSide/LevelInfo/LevelPanel/Text"]
|
[node name="LevelDescription" type="RichTextLabel" parent="Rows/Columns/RightSide/LevelInfo/LevelPanel/Text"]
|
||||||
|
@ -215,10 +215,11 @@ __meta__ = {
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="Goals" type="VBoxContainer" parent="Rows/Columns/RightSide/LevelInfo/LevelPanel"]
|
[node name="Goals" type="VBoxContainer" parent="Rows/Columns/RightSide/LevelInfo/LevelPanel"]
|
||||||
margin_top = 269.0
|
margin_top = 469.0
|
||||||
margin_right = 633.0
|
margin_right = 633.0
|
||||||
margin_bottom = 469.0
|
margin_bottom = 469.0
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
|
size_flags_stretch_ratio = 0.0
|
||||||
|
|
||||||
[node name="FileBrowser" parent="Rows/Columns/RightSide" instance=ExtResource( 5 )]
|
[node name="FileBrowser" parent="Rows/Columns/RightSide" instance=ExtResource( 5 )]
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
|
|
|
@ -17,6 +17,7 @@ var node = preload("res://scenes/node.tscn")
|
||||||
var shell = Shell.new()
|
var shell = Shell.new()
|
||||||
var objects = {}
|
var objects = {}
|
||||||
var mouse_inside = false
|
var mouse_inside = false
|
||||||
|
var has_been_layouted = false
|
||||||
|
|
||||||
# Used for caching.
|
# Used for caching.
|
||||||
var all_objects_cache
|
var all_objects_cache
|
||||||
|
@ -33,8 +34,8 @@ func _ready():
|
||||||
set_editable_path(editable_path)
|
set_editable_path(editable_path)
|
||||||
set_path(path)
|
set_path(path)
|
||||||
|
|
||||||
update_everything()
|
#update_everything()
|
||||||
update_node_positions()
|
#update_node_positions()
|
||||||
|
|
||||||
func _process(_delta):
|
func _process(_delta):
|
||||||
nodes.rect_pivot_offset = nodes.rect_size / 2
|
nodes.rect_pivot_offset = nodes.rect_size / 2
|
||||||
|
@ -60,7 +61,10 @@ func update_everything():
|
||||||
else:
|
else:
|
||||||
for o in objects:
|
for o in objects:
|
||||||
objects[o].queue_free()
|
objects[o].queue_free()
|
||||||
objects = {}
|
objects = {}
|
||||||
|
if not has_been_layouted:
|
||||||
|
update_node_positions()
|
||||||
|
has_been_layouted = true
|
||||||
|
|
||||||
func set_path(new_path):
|
func set_path(new_path):
|
||||||
path = new_path
|
path = new_path
|
||||||
|
|
Loading…
Reference in a new issue