mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2025-05-07 05:02:04 +02:00
More polish, hide unfinished chapters/levels
This commit is contained in:
parent
be45b82e41
commit
5df4932ad5
19 changed files with 48 additions and 55 deletions
levels/unused
51
levels/unused/pull-push
Normal file
51
levels/unused/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! :)
|
33
levels/unused/remotes-add
Normal file
33
levels/unused/remotes-add
Normal file
|
@ -0,0 +1,33 @@
|
|||
title = Adding a remote
|
||||
cards = checkout
|
||||
|
||||
[description]
|
||||
|
||||
Let's work together with others! Your friend has their own repo at the URL `../friend` - you can add it using
|
||||
|
||||
git remote add [name] [URL]
|
||||
|
||||
where `[name]` is an arbitrary, short name you pick for the remote.
|
||||
|
||||
When you've done that, you can get all commits from that remote using
|
||||
|
||||
git pull friend
|
||||
|
||||
There's a letter for you!
|
||||
|
||||
[setup]
|
||||
|
||||
git remote remove friend
|
||||
|
||||
[setup friend]
|
||||
|
||||
echo "I'm really committed to our friendship! <3" > love_letter
|
||||
git add .
|
||||
git commit -m "Write a letter"
|
||||
|
||||
[win]
|
||||
|
||||
# Add a remote that points to ../friend.
|
||||
git remote -v | grep '../friend'
|
||||
# Pull from the remote.
|
||||
git show HEAD:love_letter | grep committed
|
23
levels/unused/remotes-delete
Normal file
23
levels/unused/remotes-delete
Normal file
|
@ -0,0 +1,23 @@
|
|||
title = Deleting and renaming a remote
|
||||
cards = checkout
|
||||
|
||||
[description]
|
||||
|
||||
Here, you already have two remotes configured! You can list them using `git remote`.
|
||||
|
||||
[setup]
|
||||
|
||||
git remote rename friend frend
|
||||
|
||||
[setup friend]
|
||||
|
||||
[setup enemy]
|
||||
|
||||
[win]
|
||||
|
||||
# Rename the remote with the typo (using `git remote rename [old name] [new name]`)
|
||||
git remote | grep friend
|
||||
# The remote with the typo is gone.
|
||||
! grep 'frend' <(git remote)
|
||||
# Delete the remote you don't want to keep (using `git remote remove [remote]`)
|
||||
! grep 'enemy' <(git remote)
|
26
levels/unused/split
Normal file
26
levels/unused/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/unused/steps
Normal file
23
levels/unused/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"
|
Loading…
Add table
Add a link
Reference in a new issue