mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2025-05-29 20:29:00 +02:00
finished the mechanism for setting the language
This commit is contained in:
parent
705cc849c2
commit
50ee071f0e
214 changed files with 94 additions and 10 deletions
31
levels/it_IT/unused/checkout
Normal file
31
levels/it_IT/unused/checkout
Normal file
|
@ -0,0 +1,31 @@
|
|||
title = Getting the last version
|
||||
cards = checkout-file
|
||||
|
||||
[description]
|
||||
|
||||
You've been working on your essay for a while. But - ughh! Now your cat walks over your keyboard and "helps you", so now it's all messed up! :/
|
||||
|
||||
But Git is here to help! To discard all changes your cat made, and go back to the version in the last commit, use `checkout`!
|
||||
|
||||
[setup]
|
||||
|
||||
echo "A" >> essay.txt
|
||||
git add .
|
||||
git commit -m "Initial commit"
|
||||
|
||||
echo "B" >> essay.txt
|
||||
git commit -a -m "Improved version"
|
||||
|
||||
echo "C" >> essay.txt
|
||||
git commit -a -m "Even better version"
|
||||
|
||||
echo "D" >> essay.txt
|
||||
git commit -a -m "Marvelous version"
|
||||
|
||||
echo "blarg
|
||||
blaaaargh" > essay.txt
|
||||
|
||||
[win]
|
||||
|
||||
# Restore the version from the last commit.
|
||||
cat essay.txt | grep D
|
20
levels/it_IT/unused/clone
Normal file
20
levels/it_IT/unused/clone
Normal file
|
@ -0,0 +1,20 @@
|
|||
title = Cloning a repo
|
||||
cards = clone commit-auto pull push
|
||||
|
||||
[description]
|
||||
|
||||
Get your friend's repo using clone, change something, push it back.
|
||||
|
||||
[setup]
|
||||
|
||||
rm -rf .git
|
||||
|
||||
[setup friend]
|
||||
|
||||
echo hi > file
|
||||
git add .
|
||||
git commit -m "Initial commit"
|
||||
|
||||
[win friend]
|
||||
|
||||
test "$(git show main:file)" != hi
|
27
levels/it_IT/unused/commit
Normal file
27
levels/it_IT/unused/commit
Normal file
|
@ -0,0 +1,27 @@
|
|||
title = Make a commit \o/
|
||||
cards = add reset checkout commit
|
||||
|
||||
[description]
|
||||
|
||||
For practice, make a commit where all files contain an "x"!
|
||||
|
||||
[setup]
|
||||
|
||||
echo a > a
|
||||
echo x > b
|
||||
echo x > c
|
||||
git add .
|
||||
git commit -m "Initial commit"
|
||||
echo x > a
|
||||
echo b > b
|
||||
git add b
|
||||
echo c > c
|
||||
|
||||
[win]
|
||||
|
||||
# File a contains "x" in the last main commit.
|
||||
test "$(git show main:a)" = x
|
||||
# File b contains "x" in the last main commit.
|
||||
test "$(git show main:b)" = x
|
||||
# File c contains "x" in the last main commit.
|
||||
test "$(git show main:c)" = x
|
26
levels/it_IT/unused/commit-a
Normal file
26
levels/it_IT/unused/commit-a
Normal file
|
@ -0,0 +1,26 @@
|
|||
title = Make a commit, but faster!
|
||||
cards = add reset checkout commit commit-a
|
||||
|
||||
[description]
|
||||
|
||||
There is a time-saving trick, where instead of a plain `git commit`, you can use
|
||||
|
||||
git commit -a
|
||||
|
||||
This will automatically add all changes you made to local files! Very convenient.
|
||||
|
||||
[setup]
|
||||
|
||||
echo a > a
|
||||
echo b > b
|
||||
echo c > c
|
||||
git add .
|
||||
git commit -m "Initial commit"
|
||||
echo x > a
|
||||
echo x > b
|
||||
echo x > c
|
||||
|
||||
[win]
|
||||
|
||||
# Make a commit where all files contain "x".
|
||||
test "$(git show main:a)" = x && test "$(git show main:b)" = x && test "$(git show main:c)" = x
|
35
levels/it_IT/unused/fetch
Normal file
35
levels/it_IT/unused/fetch
Normal file
|
@ -0,0 +1,35 @@
|
|||
title = Fetching from remotes
|
||||
cards = checkout fetch commit-auto
|
||||
|
||||
[description]
|
||||
|
||||
Here, you already have two remotes configured! You can list them using `git remote`.
|
||||
|
||||
Fetch from both, and look at the suggestions.
|
||||
|
||||
Then, make a new commit on top of your original one that introduces a compromise.
|
||||
|
||||
[setup]
|
||||
|
||||
echo "The bikeshed should be ???" > proposal
|
||||
git add .
|
||||
git commit -m "What do you think?"
|
||||
|
||||
[setup friend1]
|
||||
|
||||
git pull yours main
|
||||
echo "The bikeshed should be green" > proposal
|
||||
git commit -am "Green"
|
||||
|
||||
[setup friend2]
|
||||
|
||||
git pull yours main
|
||||
echo "The bikeshed should be blue" > proposal
|
||||
git commit -am "Blue"
|
||||
|
||||
[win]
|
||||
|
||||
# Your proposal is acceptable for friend1.
|
||||
git show main:proposal | git grep green
|
||||
# Your proposal is acceptable for friend2.
|
||||
git show main:proposal | git grep blue
|
27
levels/it_IT/unused/files-move
Normal file
27
levels/it_IT/unused/files-move
Normal file
|
@ -0,0 +1,27 @@
|
|||
title = No sleep required
|
||||
cards = file-new file-delete file-rename
|
||||
|
||||
[description]
|
||||
|
||||
Actually, you decide that you don't need any sleep.
|
||||
|
||||
Because of that, you won't require a bed, and can build some other piece of furniture from the wood!
|
||||
|
||||
|
||||
[setup]
|
||||
|
||||
echo A yellow cupboard with lots of drawers. > cupboard
|
||||
echo A really big yellow shelf. > shelf
|
||||
echo A comfortable, yellow bed with yellow cushions. > bed
|
||||
|
||||
[win]
|
||||
|
||||
# Rename the bed into something else, and give it a new description!
|
||||
NUM_FILES="$(ls | wc -l)"
|
||||
! test -f bed && test "$NUM_FILES" -ge 3 && ! grep -r "yellow bed" .
|
||||
|
||||
[congrats]
|
||||
|
||||
Neat! It even still looks a bit comfortable!
|
||||
|
||||
You head out, eager for your first lesson at time travel school!
|
26
levels/it_IT/unused/index-mv
Normal file
26
levels/it_IT/unused/index-mv
Normal file
|
@ -0,0 +1,26 @@
|
|||
title = Rename a file in the next commit
|
||||
cards = add reset-file checkout-file mv commit
|
||||
|
||||
[description]
|
||||
|
||||
Other times, you might want to rename a file in the next commit. Use
|
||||
|
||||
git mv [file] [new name]
|
||||
|
||||
for that. The effect is very similar as if you had created a copy with a new name, and removed the old version.
|
||||
|
||||
[setup]
|
||||
|
||||
echo a > a
|
||||
echo SPECIAL > b
|
||||
echo x > c
|
||||
git add .
|
||||
git commit -m "Initial commit"
|
||||
echo x > a
|
||||
echo b >> b
|
||||
git add b
|
||||
|
||||
[win]
|
||||
|
||||
# Make a commit where you rename the file b to "x".
|
||||
test "$(git ls-tree --name-only main)" = "$(echo -e "a\nc\nx")"
|
14
levels/it_IT/unused/init
Normal file
14
levels/it_IT/unused/init
Normal file
|
@ -0,0 +1,14 @@
|
|||
title = Welcome!
|
||||
cards = init
|
||||
|
||||
[description]
|
||||
|
||||
|
||||
[setup]
|
||||
|
||||
rm -rf .git
|
||||
|
||||
[win]
|
||||
|
||||
# Again, initialize your time machine!
|
||||
test -d .git
|
51
levels/it_IT/unused/pull-push
Normal file
51
levels/it_IT/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/it_IT/unused/remotes-add
Normal file
33
levels/it_IT/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/it_IT/unused/remotes-delete
Normal file
23
levels/it_IT/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)
|
28
levels/it_IT/unused/restore
Normal file
28
levels/it_IT/unused/restore
Normal file
|
@ -0,0 +1,28 @@
|
|||
title = Looking into the past
|
||||
cards = checkout-from
|
||||
|
||||
[description]
|
||||
|
||||
You've been working on your essay for a while. But you're not happy with the changes you've made recently. You want to go back to the version called "Best version"!
|
||||
|
||||
No problem, you can use the `checkout` card to restore your essay from an older commit!
|
||||
|
||||
[setup]
|
||||
|
||||
echo "Initial version" > essay.txt
|
||||
git add .
|
||||
git commit -m "Initial commit"
|
||||
|
||||
echo "Improved version" > essay.txt
|
||||
git commit -a -m "Improved version"
|
||||
|
||||
echo "Best version" > essay.txt
|
||||
git commit -a -m "Best version"
|
||||
|
||||
echo "Less-good version" > essay.txt
|
||||
git commit -a -m "Less-good version"
|
||||
|
||||
[win]
|
||||
|
||||
# For nostalgic reasons, restore the very first backup you made!
|
||||
diff essay.txt <(echo "Best version")
|
26
levels/it_IT/unused/split
Normal file
26
levels/it_IT/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/it_IT/unused/steps
Normal file
23
levels/it_IT/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"
|
23
levels/it_IT/unused/who-are-you
Normal file
23
levels/it_IT/unused/who-are-you
Normal file
|
@ -0,0 +1,23 @@
|
|||
title = Nice to meet you!
|
||||
cards = config-name config-email
|
||||
|
||||
[description]
|
||||
|
||||
Introduce yourself using
|
||||
|
||||
git config --global user.name Firstname
|
||||
git config --global user.email "your@mail.com"
|
||||
|
||||
[setup]
|
||||
|
||||
[actions]
|
||||
|
||||
test "$(git config user.name)" != "You" && hint "Hey $(git config user.name), nice to meet you!"
|
||||
|
||||
[win]
|
||||
|
||||
# Have a name configured.
|
||||
test "$(git config user.name)" != "You"
|
||||
|
||||
# Have an email address configured.
|
||||
test "$(git config user.email)" != "you@time.agency"
|
Loading…
Add table
Add a link
Reference in a new issue