mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2025-05-01 20:42:01 +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/remotes/friend
Normal file
47
levels/remotes/friend
Normal file
|
@ -0,0 +1,47 @@
|
|||
title = Friend
|
||||
cards = pull push commit-auto checkout
|
||||
|
||||
[description]
|
||||
|
||||
Your friend added another line to your essay! Get it, add a third one and send it to them!
|
||||
|
||||
Take turns until you have five lines!
|
||||
|
||||
[setup yours]
|
||||
|
||||
echo "Line 1" > essay
|
||||
git add .
|
||||
git commit -m "One line"
|
||||
|
||||
git push -u friend main
|
||||
|
||||
[setup friend]
|
||||
|
||||
git checkout main
|
||||
echo "Line 2, gnihihi" >> essay
|
||||
git commit -am "Another line"
|
||||
|
||||
[actions friend]
|
||||
|
||||
if test "$(git log --oneline | wc -l)" -eq 3; then
|
||||
git reset --hard main # Necessary because the working directory isn't updated when we push to the friend.
|
||||
echo "Line 4, blurbblubb" >> essay
|
||||
git commit -am "Final line"
|
||||
hint "Oh nice, I added a fourth line!"
|
||||
fi
|
||||
|
||||
[win]
|
||||
|
||||
# Got the second line from your friend
|
||||
git show HEAD:essay | grep gnihihi
|
||||
|
||||
# Got the fourth line from your friend.
|
||||
git show HEAD:essay | grep blurbblubb
|
||||
|
||||
[win friend]
|
||||
|
||||
# The friend got a third line from you
|
||||
test "$(git show HEAD:essay | wc -l)" -ge 3
|
||||
|
||||
# The friend got a fifth line from you
|
||||
test "$(git show HEAD:essay | wc -l)" -ge 5
|
51
levels/remotes/pull-push
Normal file
51
levels/remotes/pull-push
Normal file
|
@ -0,0 +1,51 @@
|
|||
title = Helping each other
|
||||
cards = checkout commit-auto reset-hard pull push
|
||||
|
||||
[description]
|
||||
|
||||
The events and timelines you see are always only what your own time machine knows about!
|
||||
|
||||
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 (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 bottom).
|
||||
|
||||
[setup yours]
|
||||
|
||||
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!"
|
||||
|
||||
git checkout -b muesli main
|
||||
echo "Had muesli with oats and strawberries for breakfast." > sam
|
||||
git add .
|
||||
git commit -m "Muesli!"
|
||||
|
||||
git checkout main
|
||||
|
||||
git push -u sidekick main pancakes muesli
|
||||
|
||||
[setup sidekick]
|
||||
|
||||
git checkout main
|
||||
git merge pancakes
|
||||
git merge muesli
|
||||
|
||||
echo "Had pancakes with strawberries for breakfast." > sam
|
||||
git add .
|
||||
git commit -m "Let's make this breakfast compromise" --author="Sidekick <sidekick@example.com>"
|
||||
|
||||
[win sidekick]
|
||||
|
||||
# Below main's parent, there is a rhombus:
|
||||
git rev-parse main^^ && test "$(git rev-parse main^^1^)" = "$(git rev-parse main^^2^)"
|
||||
|
||||
[congrats]
|
||||
|
||||
In reality, in many cases, a lot of time agents work together to build a really good future together! :)
|
Loading…
Add table
Add a link
Reference in a new issue