diff --git a/levels/bisect/bisect b/levels/en/bisect/bisect similarity index 97% rename from levels/bisect/bisect rename to levels/en/bisect/bisect index cf7bf6a..0b66edb 100644 --- a/levels/bisect/bisect +++ b/levels/en/bisect/bisect @@ -9,7 +9,7 @@ Oh no! You have lost your key at some point during the day! Sure, you could look at every single commit in an attempt to find it - but there's a better way: your time machine has a built-in way to find the point in time where things went wrong quickly! -First, play the "bisect start" card. Then, go to a commit where you don't have the key, and play the "bisect bad" card. Likewise, go to a commit early on where you have the key *in your pocket*, and play the "bisect good" card. +First, play the "bisect start" card. Then, go to a commit where you don't have the key, and play the "bisect bad" card. Likewise, go to a commit early on where you have the key *in your pocket*, and play the "bisect good card". After you've found the last good commit, reset the main branch to it. What happened to the key after you lost it? diff --git a/levels/bisect/sequence b/levels/en/bisect/sequence similarity index 100% rename from levels/bisect/sequence rename to levels/en/bisect/sequence diff --git a/levels/branches/branch-create b/levels/en/branches/branch-create similarity index 100% rename from levels/branches/branch-create rename to levels/en/branches/branch-create diff --git a/levels/branches/branch-remove b/levels/en/branches/branch-remove similarity index 100% rename from levels/branches/branch-remove rename to levels/en/branches/branch-remove diff --git a/levels/branches/checkout-commit b/levels/en/branches/checkout-commit similarity index 89% rename from levels/branches/checkout-commit rename to levels/en/branches/checkout-commit index 258434d..87061d8 100644 --- a/levels/branches/checkout-commit +++ b/levels/en/branches/checkout-commit @@ -3,7 +3,7 @@ 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 yellow boxes are frozen points in time, we call them "commits"! You can travel between them using the "checkout" card! (Try it!) Can you find out what happened here? Then, while on the last commit, edit the files to fix the problem, and make a new commit! diff --git a/levels/branches/fork b/levels/en/branches/fork similarity index 100% rename from levels/branches/fork rename to levels/en/branches/fork diff --git a/levels/branches/grow b/levels/en/branches/grow similarity index 100% rename from levels/branches/grow rename to levels/en/branches/grow diff --git a/levels/branches/reorder b/levels/en/branches/reorder similarity index 100% rename from levels/branches/reorder rename to levels/en/branches/reorder diff --git a/levels/branches/sequence b/levels/en/branches/sequence similarity index 100% rename from levels/branches/sequence rename to levels/en/branches/sequence diff --git a/levels/changing-the-past/rebase b/levels/en/changing-the-past/rebase similarity index 100% rename from levels/changing-the-past/rebase rename to levels/en/changing-the-past/rebase diff --git a/levels/changing-the-past/reorder b/levels/en/changing-the-past/reorder similarity index 100% rename from levels/changing-the-past/reorder rename to levels/en/changing-the-past/reorder diff --git a/levels/changing-the-past/sequence b/levels/en/changing-the-past/sequence similarity index 100% rename from levels/changing-the-past/sequence rename to levels/en/changing-the-past/sequence diff --git a/levels/files/files-add b/levels/en/files/files-add similarity index 100% rename from levels/files/files-add rename to levels/en/files/files-add diff --git a/levels/files/files-delete b/levels/en/files/files-delete similarity index 100% rename from levels/files/files-delete rename to levels/en/files/files-delete diff --git a/levels/files/sequence b/levels/en/files/sequence similarity index 100% rename from levels/files/sequence rename to levels/en/files/sequence diff --git a/levels/index/add b/levels/en/index/add similarity index 100% rename from levels/index/add rename to levels/en/index/add diff --git a/levels/index/change b/levels/en/index/change similarity index 100% rename from levels/index/change rename to levels/en/index/change diff --git a/levels/index/checkout b/levels/en/index/checkout similarity index 100% rename from levels/index/checkout rename to levels/en/index/checkout diff --git a/levels/index/compare b/levels/en/index/compare similarity index 100% rename from levels/index/compare rename to levels/en/index/compare diff --git a/levels/index/new b/levels/en/index/new similarity index 100% rename from levels/index/new rename to levels/en/index/new diff --git a/levels/index/reset b/levels/en/index/reset similarity index 100% rename from levels/index/reset rename to levels/en/index/reset diff --git a/levels/index/rm b/levels/en/index/rm similarity index 100% rename from levels/index/rm rename to levels/en/index/rm diff --git a/levels/index/sequence b/levels/en/index/sequence similarity index 100% rename from levels/index/sequence rename to levels/en/index/sequence diff --git a/levels/index/steps b/levels/en/index/steps similarity index 100% rename from levels/index/steps rename to levels/en/index/steps diff --git a/levels/intro/cli b/levels/en/intro/cli similarity index 100% rename from levels/intro/cli rename to levels/en/intro/cli diff --git a/levels/intro/commit b/levels/en/intro/commit similarity index 100% rename from levels/intro/commit rename to levels/en/intro/commit diff --git a/levels/intro/copies b/levels/en/intro/copies similarity index 100% rename from levels/intro/copies rename to levels/en/intro/copies diff --git a/levels/intro/init b/levels/en/intro/init similarity index 84% rename from levels/intro/init rename to levels/en/intro/init index 01e6071..ea0426e 100644 --- a/levels/intro/init +++ b/levels/en/intro/init @@ -5,7 +5,7 @@ cards = init You've been accepted to time travel school! Yay! It's your first day! Your teacher explains: -'To do anything with a time machine, you first need to initialize it!' +"To do anything with a time machine, you first need to initialize it!" Drag that blue card up to play it! diff --git a/levels/intro/remote b/levels/en/intro/remote similarity index 100% rename from levels/intro/remote rename to levels/en/intro/remote diff --git a/levels/intro/risky b/levels/en/intro/risky similarity index 94% rename from levels/intro/risky rename to levels/en/intro/risky index de8560a..a5e7239 100644 --- a/levels/intro/risky +++ b/levels/en/intro/risky @@ -3,7 +3,7 @@ cards = [description] -So you have decided to apply for time travel school, to learn how to use this time machine called 'Git'! +So you have decided to apply for time travel school, to learn how to use this time machine called "Git"! How exciting! diff --git a/levels/intro/sequence b/levels/en/intro/sequence similarity index 100% rename from levels/intro/sequence rename to levels/en/intro/sequence diff --git a/levels/intro/who-are-you b/levels/en/intro/who-are-you similarity index 100% rename from levels/intro/who-are-you rename to levels/en/intro/who-are-you diff --git a/levels/low-level/basics b/levels/en/low-level/basics similarity index 100% rename from levels/low-level/basics rename to levels/en/low-level/basics diff --git a/levels/low-level/blob-create b/levels/en/low-level/blob-create similarity index 100% rename from levels/low-level/blob-create rename to levels/en/low-level/blob-create diff --git a/levels/low-level/blob-remove b/levels/en/low-level/blob-remove similarity index 100% rename from levels/low-level/blob-remove rename to levels/en/low-level/blob-remove diff --git a/levels/low-level/commit-create b/levels/en/low-level/commit-create similarity index 100% rename from levels/low-level/commit-create rename to levels/en/low-level/commit-create diff --git a/levels/low-level/commit-parents b/levels/en/low-level/commit-parents similarity index 100% rename from levels/low-level/commit-parents rename to levels/en/low-level/commit-parents diff --git a/levels/low-level/commit-rhombus b/levels/en/low-level/commit-rhombus similarity index 100% rename from levels/low-level/commit-rhombus rename to levels/en/low-level/commit-rhombus diff --git a/levels/low-level/index-add b/levels/en/low-level/index-add similarity index 100% rename from levels/low-level/index-add rename to levels/en/low-level/index-add diff --git a/levels/low-level/index-remove b/levels/en/low-level/index-remove similarity index 100% rename from levels/low-level/index-remove rename to levels/en/low-level/index-remove diff --git a/levels/low-level/index-update b/levels/en/low-level/index-update similarity index 100% rename from levels/low-level/index-update rename to levels/en/low-level/index-update diff --git a/levels/low-level/puzzle-apocalypse b/levels/en/low-level/puzzle-apocalypse similarity index 100% rename from levels/low-level/puzzle-apocalypse rename to levels/en/low-level/puzzle-apocalypse diff --git a/levels/low-level/puzzle-precious-blob b/levels/en/low-level/puzzle-precious-blob similarity index 100% rename from levels/low-level/puzzle-precious-blob rename to levels/en/low-level/puzzle-precious-blob diff --git a/levels/low-level/puzzle-trees-all-the-way-down b/levels/en/low-level/puzzle-trees-all-the-way-down similarity index 100% rename from levels/low-level/puzzle-trees-all-the-way-down rename to levels/en/low-level/puzzle-trees-all-the-way-down diff --git a/levels/low-level/ref-create b/levels/en/low-level/ref-create similarity index 100% rename from levels/low-level/ref-create rename to levels/en/low-level/ref-create diff --git a/levels/low-level/ref-move b/levels/en/low-level/ref-move similarity index 100% rename from levels/low-level/ref-move rename to levels/en/low-level/ref-move diff --git a/levels/low-level/ref-remove b/levels/en/low-level/ref-remove similarity index 100% rename from levels/low-level/ref-remove rename to levels/en/low-level/ref-remove diff --git a/levels/low-level/sequence b/levels/en/low-level/sequence similarity index 100% rename from levels/low-level/sequence rename to levels/en/low-level/sequence diff --git a/levels/low-level/symref-create b/levels/en/low-level/symref-create similarity index 100% rename from levels/low-level/symref-create rename to levels/en/low-level/symref-create diff --git a/levels/low-level/symref-no-deref b/levels/en/low-level/symref-no-deref similarity index 100% rename from levels/low-level/symref-no-deref rename to levels/en/low-level/symref-no-deref diff --git a/levels/low-level/tree-create b/levels/en/low-level/tree-create similarity index 100% rename from levels/low-level/tree-create rename to levels/en/low-level/tree-create diff --git a/levels/low-level/tree-nested b/levels/en/low-level/tree-nested similarity index 100% rename from levels/low-level/tree-nested rename to levels/en/low-level/tree-nested diff --git a/levels/low-level/tree-read b/levels/en/low-level/tree-read similarity index 100% rename from levels/low-level/tree-read rename to levels/en/low-level/tree-read diff --git a/levels/low-level/welcome b/levels/en/low-level/welcome similarity index 100% rename from levels/low-level/welcome rename to levels/en/low-level/welcome diff --git a/levels/merge/conflict b/levels/en/merge/conflict similarity index 100% rename from levels/merge/conflict rename to levels/en/merge/conflict diff --git a/levels/merge/merge b/levels/en/merge/merge similarity index 100% rename from levels/merge/merge rename to levels/en/merge/merge diff --git a/levels/merge/merge-abort b/levels/en/merge/merge-abort similarity index 100% rename from levels/merge/merge-abort rename to levels/en/merge/merge-abort diff --git a/levels/merge/sequence b/levels/en/merge/sequence similarity index 100% rename from levels/merge/sequence rename to levels/en/merge/sequence diff --git a/levels/remotes/friend b/levels/en/remotes/friend similarity index 100% rename from levels/remotes/friend rename to levels/en/remotes/friend diff --git a/levels/remotes/problems b/levels/en/remotes/problems similarity index 100% rename from levels/remotes/problems rename to levels/en/remotes/problems diff --git a/levels/remotes/sequence b/levels/en/remotes/sequence similarity index 100% rename from levels/remotes/sequence rename to levels/en/remotes/sequence diff --git a/levels/sandbox/empty b/levels/en/sandbox/empty similarity index 100% rename from levels/sandbox/empty rename to levels/en/sandbox/empty diff --git a/levels/sandbox/remote b/levels/en/sandbox/remote similarity index 100% rename from levels/sandbox/remote rename to levels/en/sandbox/remote diff --git a/levels/sandbox/sequence b/levels/en/sandbox/sequence similarity index 100% rename from levels/sandbox/sequence rename to levels/en/sandbox/sequence diff --git a/levels/sandbox/three-commits b/levels/en/sandbox/three-commits similarity index 100% rename from levels/sandbox/three-commits rename to levels/en/sandbox/three-commits diff --git a/levels/sequence b/levels/en/sequence similarity index 100% rename from levels/sequence rename to levels/en/sequence diff --git a/levels/shit-happens/bad-commit b/levels/en/shit-happens/bad-commit similarity index 100% rename from levels/shit-happens/bad-commit rename to levels/en/shit-happens/bad-commit diff --git a/levels/shit-happens/pushed-something-broken b/levels/en/shit-happens/pushed-something-broken similarity index 100% rename from levels/shit-happens/pushed-something-broken rename to levels/en/shit-happens/pushed-something-broken diff --git a/levels/shit-happens/reflog b/levels/en/shit-happens/reflog similarity index 100% rename from levels/shit-happens/reflog rename to levels/en/shit-happens/reflog diff --git a/levels/shit-happens/restore-a-file b/levels/en/shit-happens/restore-a-file similarity index 100% rename from levels/shit-happens/restore-a-file rename to levels/en/shit-happens/restore-a-file diff --git a/levels/shit-happens/restore-a-file-from-the-past b/levels/en/shit-happens/restore-a-file-from-the-past similarity index 100% rename from levels/shit-happens/restore-a-file-from-the-past rename to levels/en/shit-happens/restore-a-file-from-the-past diff --git a/levels/shit-happens/sequence b/levels/en/shit-happens/sequence similarity index 100% rename from levels/shit-happens/sequence rename to levels/en/shit-happens/sequence diff --git a/levels/stash/sequence b/levels/en/stash/sequence similarity index 100% rename from levels/stash/sequence rename to levels/en/stash/sequence diff --git a/levels/stash/stash b/levels/en/stash/stash similarity index 100% rename from levels/stash/stash rename to levels/en/stash/stash diff --git a/levels/stash/stash-branch b/levels/en/stash/stash-branch similarity index 100% rename from levels/stash/stash-branch rename to levels/en/stash/stash-branch diff --git a/levels/stash/stash-clear b/levels/en/stash/stash-clear similarity index 100% rename from levels/stash/stash-clear rename to levels/en/stash/stash-clear diff --git a/levels/stash/stash-merge b/levels/en/stash/stash-merge similarity index 100% rename from levels/stash/stash-merge rename to levels/en/stash/stash-merge diff --git a/levels/stash/stash-pop b/levels/en/stash/stash-pop similarity index 100% rename from levels/stash/stash-pop rename to levels/en/stash/stash-pop diff --git a/levels/tags/add-tag b/levels/en/tags/add-tag similarity index 100% rename from levels/tags/add-tag rename to levels/en/tags/add-tag diff --git a/levels/tags/add-tag-later b/levels/en/tags/add-tag-later similarity index 100% rename from levels/tags/add-tag-later rename to levels/en/tags/add-tag-later diff --git a/levels/tags/remote-tag b/levels/en/tags/remote-tag similarity index 100% rename from levels/tags/remote-tag rename to levels/en/tags/remote-tag diff --git a/levels/tags/remove-tag b/levels/en/tags/remove-tag similarity index 100% rename from levels/tags/remove-tag rename to levels/en/tags/remove-tag diff --git a/levels/tags/sequence b/levels/en/tags/sequence similarity index 100% rename from levels/tags/sequence rename to levels/en/tags/sequence diff --git a/levels/unused/checkout b/levels/en/unused/checkout similarity index 100% rename from levels/unused/checkout rename to levels/en/unused/checkout diff --git a/levels/unused/clone b/levels/en/unused/clone similarity index 100% rename from levels/unused/clone rename to levels/en/unused/clone diff --git a/levels/unused/commit b/levels/en/unused/commit similarity index 100% rename from levels/unused/commit rename to levels/en/unused/commit diff --git a/levels/unused/commit-a b/levels/en/unused/commit-a similarity index 100% rename from levels/unused/commit-a rename to levels/en/unused/commit-a diff --git a/levels/unused/fetch b/levels/en/unused/fetch similarity index 100% rename from levels/unused/fetch rename to levels/en/unused/fetch diff --git a/levels/unused/files-move b/levels/en/unused/files-move similarity index 100% rename from levels/unused/files-move rename to levels/en/unused/files-move diff --git a/levels/unused/index-mv b/levels/en/unused/index-mv similarity index 100% rename from levels/unused/index-mv rename to levels/en/unused/index-mv diff --git a/levels/unused/init b/levels/en/unused/init similarity index 100% rename from levels/unused/init rename to levels/en/unused/init diff --git a/levels/unused/pull-push b/levels/en/unused/pull-push similarity index 100% rename from levels/unused/pull-push rename to levels/en/unused/pull-push diff --git a/levels/unused/remotes-add b/levels/en/unused/remotes-add similarity index 100% rename from levels/unused/remotes-add rename to levels/en/unused/remotes-add diff --git a/levels/unused/remotes-delete b/levels/en/unused/remotes-delete similarity index 100% rename from levels/unused/remotes-delete rename to levels/en/unused/remotes-delete diff --git a/levels/unused/restore b/levels/en/unused/restore similarity index 100% rename from levels/unused/restore rename to levels/en/unused/restore diff --git a/levels/unused/split b/levels/en/unused/split similarity index 100% rename from levels/unused/split rename to levels/en/unused/split diff --git a/levels/unused/steps b/levels/en/unused/steps similarity index 100% rename from levels/unused/steps rename to levels/en/unused/steps diff --git a/levels/unused/who-are-you b/levels/en/unused/who-are-you similarity index 100% rename from levels/unused/who-are-you rename to levels/en/unused/who-are-you diff --git a/levels/workflows/gitignore b/levels/en/workflows/gitignore similarity index 100% rename from levels/workflows/gitignore rename to levels/en/workflows/gitignore diff --git a/levels/workflows/pr b/levels/en/workflows/pr similarity index 65% rename from levels/workflows/pr rename to levels/en/workflows/pr index 2496c1f..1c72510 100644 --- a/levels/workflows/pr +++ b/levels/en/workflows/pr @@ -3,8 +3,7 @@ cards = clone commit-auto reset-hard checkout file-new branch [description] -Your friend has a problem! Clone the repo located in `../friend`, create a branch called "solution", and fix the problem in this branch. When you're ready, make a "Pull Request" by using `git tag pr`. - +Your friend has a problem! Clone the repo, create a branch called "solution", and fix the problem in this branch. When you're ready, make a "Pull Request" by using `git tag pr`. [setup] diff --git a/levels/workflows/sequence b/levels/en/workflows/sequence similarity index 100% rename from levels/workflows/sequence rename to levels/en/workflows/sequence diff --git a/levels/it/bisect/bisect b/levels/it/bisect/bisect new file mode 100644 index 0000000..a80e2e8 --- /dev/null +++ b/levels/it/bisect/bisect @@ -0,0 +1,43 @@ +title = Strada di mattoni gialli +cards = checkout commit-auto reset-hard bisect-start bisect-good bisect-bad + +[description] + +(Perpiacere rimpicciolisci un pochino usando la rotella del mouse! :D) + +Oh no! Hai perso la tua chiave da qualche parte durante il giorno! + +Sicuro, certo potresti guardare in ogni singolo commit nella speranza di trovarlo - ma c'è un modo migliore: la tua macchina del tempo ha un modo integrato per trovare velocemente il punto nel tempo dove le cose sono andate male! + +Per prima cosa, gioca la carta "bisec start". Quindi, vai ad un commit in cui non hai la chiave e gioca la carta "bisect bad". Allo stesso modo vai velocemente in un commit dove hai la chiave *in tascca* e gioca la carta "bisect goofìd". + +Dopo aver trovato l'ultimo commit valido reimposta la branch principale su di esso. Cosa è successo alla chiave dopo che l'hai persa? + +[setup] + +echo "Hai ancora la tua chiave." > you + +for i in {1..30}; do + if test $i -eq 12; then + echo "La tua tasca è vuota." > you + echo "E' per terra." > key + fi + if test $i -eq 13; then + echo "Tiene una chiave nel becco." > bird + rm key + fi + if test $i -eq 14; then + rm bird + fi + git add . + git commit --allow-empty -m "$i" +done + +[win] + +# Trova l'ultimo commit buono +test "$(git log --pretty=%s main | head -1)" -eq 11 + +[congrats] + +Molto bene! :) L'unico problema è che adesso devi tornare a casa camminando, dinuovo... diff --git a/levels/it/bisect/sequence b/levels/it/bisect/sequence new file mode 100644 index 0000000..e8018fe --- /dev/null +++ b/levels/it/bisect/sequence @@ -0,0 +1 @@ +bisect diff --git a/levels/it/branches/branch-create b/levels/it/branches/branch-create new file mode 100644 index 0000000..2544ead --- /dev/null +++ b/levels/it/branches/branch-create @@ -0,0 +1,44 @@ +title = Creare ramificazioni +cards = checkout commit-auto branch branch-delete reset-hard + +[description] + +Vieni invitato a due feste! In una di queste, suona il tuo gruppo preferito e l'altra è la festa del tuo miglio amico. Dove andrai? Non preoccuparti - come agente del viaggio nel tempo, puoi andare ad entrambe le feste! + +Per rendere più facile dire quale sia la linea temporale, puoi creare portali temporali! (Chiamiamoli "rami-branchs") + +[cli] + +Anche viaggiare tra differenti rami temporali è davvero facile usando la linea di comando! Hai un ramo chiamato "birthday", puoi digitare `git checkout birthday` per arrivarci. + +[setup] + +echo "Incarta il regalo di compleanno e prendi il biglietto del concerto." > you +git add . +git commit -m "Preparazione serale" +echo "Vai alla festa di compleanno!" >> you +git add . +git commit -m "Vai al compleanno" + +git checkout HEAD~1 +echo "Vai al concerto!" > you +git add . +git commit -m "Vai al concerto" + +git checkout HEAD~1 + +git branch -D main + +[win] + +# Crea un ramo chiamato 'birthday' questo punta alla linea temporale del compleanno +git show birthday | grep 'birthday' + +# Crea un ramo chiamato 'concert' questo punta alla linea temporale del compleanno +git show concert | grep 'concert' + +[congrats] + +Adesso tu puoi viaggiare tra quie rami facilmente (usando `git checkout`) - Prova! + +Il tuo amico è felice che tu sia andato alla sua festa di compleanno e anche tu sei contento del biglietto del concerto firmato. Yay! diff --git a/levels/it/branches/branch-remove b/levels/it/branches/branch-remove new file mode 100644 index 0000000..00a2d4c --- /dev/null +++ b/levels/it/branches/branch-remove @@ -0,0 +1,47 @@ +title = Cancellare rami +cards = checkout commit-auto reset-hard branch-delete + +[description] + +La vita è piena di pericolim, vero? Anche quando cammini a scuola2, sembra che ci siano molti rischi! + +Questo Lunedì è particolarmente brutto.Sei arrivato a scuola ma ci sono delle line temporali che tu non vuoi tenere in giro + +[setup] + +echo Esci di casa e ti incammini verso la scuola. > you +git add . +git commit -m "Buon giorno!" + +echo Cammini nel lato destro della strada. >> you +git commit -am "Lato destro" + +echo Salti in un tombino nel marciapiede e arrivi in orario a scuola. >> you +git commit -am "Salto" + +git checkout HEAD^ -b friend +echo "All'improvviso cadi in una pozzanghera puzzolente e vieni mangiato da degli alligatori." >> you +git commit -am "Un nuovo amico" + +git checkout HEAD~2 -b music +echo Cammini nel lato sinistro della strada. >> you +git commit -am "Lato sinistro" + +echo Siccome sei in ritardo, inizi a corre ma qualcuno lanci un pianoforte dalla finestra e ti schiacci. >> you +git commit -am "Bei suoni" + +git checkout HEAD^ -b ice-cream +echo Non sei preoccupato e cammini lentamente. Prendi anche un gelato per strada. Arrivi troppo tardi a scuola, il tuo insegnante è arrabbiato e vieni espulso da scuola. >> you +git commit -am "Yum" + +git branch -M main leap +git checkout leap^^ + +[win] + +# Trova i rami cattivi e cancellali. Tieni solo il migliore. +test "$(git show-ref --heads | cut -f2 -d' ')" = "$(echo refs/heads/leap)" + +[congrats] + +Ripensandoci preferisci la linea temporale del gelato? :) diff --git a/levels/it/branches/checkout-commit b/levels/it/branches/checkout-commit new file mode 100644 index 0000000..3d913df --- /dev/null +++ b/levels/it/branches/checkout-commit @@ -0,0 +1,43 @@ +title = Muoversi attraverso il tempo +cards = checkout commit-auto + +[description] + +La scatole gialle sono un punto fisso nel tempo, possiamo chiamarli "commits"! Puoi viaggiare tra loro usando la carta "checkout"! (Provala!) + +Puoi scoprire cosa è successo qui? Quindi, durante ultimo commit, modifica i files per risolvere il problema ed invia un nuovo commit! + +[cli] + +Guarda uno specifico commit, digita `git checkout` uno spazio e premi il tasto destro sopra il commit che vuoi! + +Questo inserirà l'identificatore unico del commit! + +[setup] + +echo "Questo salvadanaio appartiene alla sorella maggiore. +Contiene 10 monete." > piggy_bank +git add . +git commit -m "L'inizio" + +echo "Una giovane donna con capelli, ricci, marroni." > little_sister +git add . +git commit -m "La sorella piccola è arrivata" + +echo "Ha 10 monete." >> little_sister +echo "Questo salvadanaio appartiene alla sorella maggiore. +E' vuoto." > piggy_bank +git add . +git commit -m "La sorella piccola ha fatto qualcosa" + +git checkout HEAD^^ +git branch -df main + +[win] + +# Ripristina il salvadanaio della sorella. +{ git show HEAD:piggy_bank | grep "10 monete"; } && { git show HEAD:little_sister | grep -v "10 monete"; } && { git rev-parse HEAD^^^; } + +[congrats] + +Stupendo! Adesso hai preso famiglirità con la macchina del tempo, vediamo situazioni più complicate... diff --git a/levels/it/branches/fork b/levels/it/branches/fork new file mode 100644 index 0000000..46b94c6 --- /dev/null +++ b/levels/it/branches/fork @@ -0,0 +1,65 @@ +title = Crea universi paralleli +cards = checkout commit-auto + +[description] + +Sai che creare line temporali parallele è perfettamente legale e sicuro? Vero! + +Puoi scoprire qundo le cose sono andate male in questo zoo? Poi torna all'ultimo momento buono e crea un universo parallelo dove sono tutti felicy! + +[cli] + +L'animale blue rappresenta un concetto conosciuto come "HEAD pointer" in Git: Ti mostra qual'è il commit attuale. + +Ecco un simpatico trucchetto andare al commit precedente: + + git checkout HEAD^ + +Puoi anche andare indietro di 2 commit digitando, pre esempio: + + git checkout HEAD~2 + +[setup] + +mkdir cage +echo "Sembra molto affamato." > cage/lion + +echo "Un ragazzino.. +Ama veramente i gatti!" > child +git add . +git commit -m "L'inizio" + +echo "Tiene in mano un leccalecca." >> child +git commit -am "Il ragazzo compra qualcosa" + +mv child cage +git add . +git commit -m "Il bambino si arrampica da qualche parte" + +git rm cage/child +echo "E' felice. :)" > cage/lion +git add . +git commit -m "Oh no" + +echo "Sta dormendo." > cage/lion +git add . +git commit -m "Ora del pisolino!" + +git checkout --detach +git branch -d main + +[win] + +# Assicurati che il ragazzino sia felice. +git ls-tree --name-only -r HEAD | grep child + +# Assicurati che il leone abbia qualcosa da mangiare. +git show HEAD:cage/lion | grep -v "molto affamato" + +[congrats] + +Whew, ottimo lavoro! Questo sembra un risultato molto migliore. + +Sentiti libero di aggiungere altre line temporali parallele o allungarle. + +Se sei pronto, la prossima missione ci sta aspettando... diff --git a/levels/it/branches/grow b/levels/it/branches/grow new file mode 100644 index 0000000..d560682 --- /dev/null +++ b/levels/it/branches/grow @@ -0,0 +1,48 @@ +title = I rami crescono con tè! +cards = checkout commit-auto branch branch-delete reset-hard + +[description] + +Nota che ci sono due opzioni per "viaggire fino alla fine della linea temporale": + +Primo, puoi direttamente viaggiare al commit, come abbiamo fatto prima. + +e secondo, puoi viaggiare fino all'etichetta del ramo. In questo caso, quando crei un nuovo commit, il ramo cresce con te e punta ancora alla fine della linea temporale! + +[cli] +Per viaggire in un ramo, digita `git checkout name_of_the_branch`. + +e per viaggiare all'ultimo commit, digita `git checkout --detach name_of_the_branch`. + +[setup] + +echo "In carti il regalo di complanno e prendi il biglietto del concerto." > you +git add . +git commit -m "Preparazioni della sera" +echo "Vai alla festa di compleanno!" >> you +git add . +git commit -m "Vai alla festa di compleanno" +git branch birthday + +git checkout HEAD~1 +echo "Vai al concerto!" > you +git add . +git commit -m "Vai al concerto" +git branch concert + +git checkout HEAD~1 + +git branch -D main + +[win] + +# Viaggi direttamente all'ultimo commit giallo della line temporale del compleanno, fai un cambiamento per te e crea un 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 + +# Viaggi fino al ramo, blue, del concerto, fai un cambiamento ed un commit. +git show concert^ | grep "Vai al concerto" diff --git a/levels/it/branches/reorder b/levels/it/branches/reorder new file mode 100644 index 0000000..d8a0212 --- /dev/null +++ b/levels/it/branches/reorder @@ -0,0 +1,89 @@ +title = Muovere i rami +cards = checkout commit-auto merge reset-hard + +[description] + +Uno dei tuoi colleghi ha fatto un casino qui e ha messo le branches nelle line temporali sbagliate! + +Potresti cancellare e ricreare queste branches - ma puoi anche muoverle direttamente in un differente commit usando: + + git checkout + +nel nome della branch e poi usare + + git reset --hard + +nel commit dove vuoi che la branch vada. + +La ciambella è nella branch giusto ma la linea temporale è incompleta - fai *mangiare* la ciambella a quella branch! + +[setup] + +echo "Tu non hai una baguette. + +Non hai un caffe. + +Non hai una ciambella." > you + +git add . +git commit -m "L'inizio" + +git checkout -b coffee +echo "Tu hai una baguette. + +Non hai un caffe. + +Non hai una ciambella." > you +git add . +git commit -m "Compri una ciambella" + +echo "Mangi una baguette. + +Non hai un caffe. + +Non hai una ciambella." > you +git add . +git commit -m "Mangi una baguette" + +git checkout -b baguette main +echo "Non hai una ciambella. + +Hai un caffe. + +Non hai una ciambella." > you +git add . +git commit -m "Compri un pò di caffe" + +echo "Non hai una baguette. + +Hai bevuto caffe. + +Non hai una ciambella." > you +git add . +git commit -m "Bevi il caffe" + +git checkout -b donut main +echo "Non hai una baguette. + +Non hai caffe. + +Hai una ciambella." > you +git add . +git commit -m "Compri una ciambella" + +git checkout --detach main + +[win] + +# Mangi una baguette nella branch delle baguette? +git show baguette:you | grep "Mangi.*baguette" + +# Bevi un caffe nella branch del caffe? +git show coffee:you | grep "Bevi.*coffe" + +# Mangi una ciambella nella branch delle ciambelle? +git show donut:you | grep "Mangi.*ciambella" + +[actions] + +test "$(git rev-parse HEAD^)" = "$(git rev-parse donut)" && hint "Ricordati di controllare l'etichetta branch blue quando vuoi che cresca con la linea temporale." diff --git a/levels/it/branches/sequence b/levels/it/branches/sequence new file mode 100644 index 0000000..2619ea0 --- /dev/null +++ b/levels/it/branches/sequence @@ -0,0 +1,6 @@ +checkout-commit +fork +branch-create +grow +branch-remove +reorder diff --git a/levels/it/changing-the-past/rebase b/levels/it/changing-the-past/rebase new file mode 100644 index 0000000..a704c80 --- /dev/null +++ b/levels/it/changing-the-past/rebase @@ -0,0 +1,86 @@ +title = Rebasing +cards = checkout commit-auto reset-hard rebase + +[description] + +Okay - Salta vuori che risparmiare tempo al mattino utilizzando universi paralleli è contro il regolamento dell'International Time Travel Association. Dovrai svolgere i tuoi compiti in sequenza dopotutto. + +Vedi la carta "rebase"? Quando la trascini su di un commit, copierà dopo di esso tutti gli eventi della linea temporale su cui ti trovi! In questo modo crei una linea temporale chiara e pulita dove visiti tutti e tre i negozzi. + +Nuovamente, vogliamo rendere questa la nostra realtà di base - il ramo "main" dovrebbe puntare a quella linea temporale! + +[setup] + +echo "Non hai una baguette. + +Non hai caffe. + +Non hai una ciambella." > you + +git add . +git commit -m "L'inizio" + +git checkout -b baguette main +echo "Hai una baguette. + +Non hai caffe. + +Non hai una ciambella." > you +git add . +git commit -m "Compri una baguette" + +echo "Mangi una baguette. + +Non hai caffe. + +Non hai una ciambella." > you +git add . +git commit -m "Mangi la baguette" + +git checkout -b coffee main +echo "Non hai una baguette. + +Hai del caffe. + +Non hai una ciambella." > you +git add . +git commit -m "Compri un pò di caffe" + +echo "Non hai una baguette. + +Hai bevuto caffe. + +Non hai una ciambella." > you +git add . +git commit -m "Bevi il caffe" + +git checkout -b donut main +echo "Non hai una baguette + +Non hai caffe. + +Hai una ciamebella." > you +git add . +git commit -m "Compri una ciambella" + +echo "Non hai una baguette. + +Non hai caffe. + +Mangi una ciambella." > you +git add . +git commit -m "Mangi la ciambella" + +git checkout --detach main + + +[win] + +# Ordina le tre ramificazioni in una e muovi il riferimento al ramo principale +{ git show main:you | grep "Mangi.*baguette"; } && { git show main:you | grep "bevuto.*caffe"; } && { git show main:you | grep "Mangi.*ciambella"; } && { test "$(git log main --oneline | wc -l)" -eq 7; } + +[congrats] + +Nota come gli altri commit e linee temporali siano ancora li - se qualcosa va storto, puoi ancora tornare in dietro. + +E' davvero difficile *distruggere* le cose con la tua macchina del tempo. diff --git a/levels/it/changing-the-past/reorder b/levels/it/changing-the-past/reorder new file mode 100644 index 0000000..8bbe21a --- /dev/null +++ b/levels/it/changing-the-past/reorder @@ -0,0 +1,77 @@ +title = Riordinare gli eventi +cards = checkout commit-auto reset-hard rebase-interactive cherry-pick + +[description] + +Oops, guarda c'è qualcosa di incasinato qui. Puoi rimettere gli eventi nel corretto ordine? + +Ci sono due modi per farlo: Puoi trascinare la carta "interactive rebase" sul commit precedente a quello che vuoi cambiare, poi riordinare le linee nel file che si apre e salvarlo. +Oppure puoi reimpostare il tag principale al primo commit, quindi selezionare i singoli commit (cherry-pick) nell'ordine desiderato. Hai carte per entrambe i modi! + +[setup] + +echo "Ti sei appena svegliato. + +Non indossi biancheria intima. + +Non indossi pantaloni. + +Non indossi la maglia. + +Non indossi le scarpe." > you +git add . + +git commit -m "L'inizio" + +echo "Ti sei appena svegliato. + +Non indossi biancheria intima. + +Non indossi pantaloni. + +Non indossi la maglia. + +Indossi le scarpe." > you +git commit -am "Metti le scarpe" + +echo "Ti sei appena svegliato. + +Non indossi biancheria intima. + +Indossi pantaloni. + +Non indossi la maglia. + +Indossi le scarpe." > you +git commit -am "Metti i pantaloni" + +echo "Ti sei appena svegliato. + +Indossi la biancheria intima. + +Indossi pantaloni. + +Non indossi la maglia. + +Indossi le scarpe." > you +git commit -am "Metti biancheria intima" + +echo "Ti sei appena svegliato. + +Indossi biancheria intima. + +Indossi pantaloni. + +Indossi la maglia. + +Indossi le scarpe." > you +git commit -am "Ti metti la maglia" + +[win] + +# Riordina i commit per vestirti nel modo corretto +{ git log main --oneline | perl -0777 -ne'exit(1) if not /scarpe[\s\S]*pantaloni[\s\S]*biancheria/'; } && { test "$(git log main --oneline | wc -l)" -eq 5; } + +[congrats] + +Sentiti libero di resettare il livello e provare l'altra strategia! Qual'è quella che preferisci? diff --git a/levels/it/changing-the-past/sequence b/levels/it/changing-the-past/sequence new file mode 100644 index 0000000..43c5d08 --- /dev/null +++ b/levels/it/changing-the-past/sequence @@ -0,0 +1,2 @@ +rebase +reorder diff --git a/levels/it/files/files-add b/levels/it/files/files-add new file mode 100644 index 0000000..f0149b9 --- /dev/null +++ b/levels/it/files/files-add @@ -0,0 +1,31 @@ +title = Arredatore di interni +cards = file-new file-delete + +[description] + +Ora che la tua stanza sembra in ordine, puoi iniziare a disfare le tue cose. Hai portato con te due mobili nuovi e con un sorriso luminoso, +vedi che i loro colori corrispondono al colore del tuo letto! + +Costruisci i tuoi due mobili usando la carta touch. +Quindi dai il nome ai tuoi mobili - puoi sciegliere quello che tu vuoi. + +Assicurati che i colori siano uguali! Puoi trovare il colore del letto nella descrizione. +Non dimenticare di aggiungere un colore e una descrizione anche ai tuoi nuovi mobile. + +[setup] +echo Un accogliente letto giallo. > bed + +[win] + +# Aggiungi altri due mobili +NUM_FILES="$(ls | wc -l)" +test "$NUM_FILES" -ge 3 + +# Assicurati che i colori corrispondano a quelle del tuo letto +NUM_FILES="$(ls | wc -l)" +YELLOW_FILES="$(grep -li giallo * | wc -l)" +test "$NUM_FILES" -ge 2 && test "$YELLOW_FILES" = "$NUM_FILES" + +[congrats] + +Non ti senti già più a casa? diff --git a/levels/it/files/files-delete b/levels/it/files/files-delete new file mode 100644 index 0000000..9b207dc --- /dev/null +++ b/levels/it/files/files-delete @@ -0,0 +1,36 @@ +title = Coinquilini inaspettati +cards = file-delete + +[description] + +Il primo giorno alla Scuola del viaggio nel tempo sta per finire e tu ricevi le chiavi della tua stanza. +Eccitatissimo apri la porta giusto per vedere... ragnatele! Ragnatele ovunque! + +Cava tutte le ragnatele che puoi trovare con la carta remove! + +[cli] + +Nella line di comando, puoi facilmente eliminare tutti i file che finiscono in "web" usando il comando: + + rm *web + +[setup] + +echo Una piccola ragnatela è accanto alla tua finestra. > tiny_web +echo Una grande ragnatela attaccata sopra al tuo letto. > big_web +echo Un letto accogliente. > bed +echo Una ragnatela spessa è alla destra della tua porta. > thick_web + +[win] + +# Rimuovi tutte le ragnatele. +! ls | grep thick_web && +! ls | grep big_web && +! ls | grep tiny_web + +# Ma assicurati di mantenere il tuo letto! +ls | grep bed + +[congrats] + +Guarda la tua stanza adesso è davvero ordinata ed accogliente! Il momento per disfare le valige! diff --git a/levels/it/files/sequence b/levels/it/files/sequence new file mode 100644 index 0000000..cb24408 --- /dev/null +++ b/levels/it/files/sequence @@ -0,0 +1,3 @@ +files-delete +files-add + diff --git a/levels/it/index/#sequence# b/levels/it/index/#sequence# new file mode 100644 index 0000000..42f7f48 --- /dev/null +++ b/levels/it/index/#sequence# @@ -0,0 +1,5 @@ +compare +new +change +reset +steps diff --git a/levels/it/index/add b/levels/it/index/add new file mode 100644 index 0000000..e627917 --- /dev/null +++ b/levels/it/index/add @@ -0,0 +1,38 @@ +title = Updating files in the index +cards = add commit checkout + +[description] + +So you start working, and make changes to your files! Git lets you choose which of these changes you want to put in the next commit. This is like updating the index version of that file to the new version. + +This allows you to have smaller commits, that describe better what you changed! + +The command for this is the same - `git add`! + +[setup] + +echo a > a +echo b > b +echo c > c +git add . +git commit -m "Initial commit" + +[win] + +# Make changes to all files! +test "$(cat a)" != "a" && +test "$(cat b)" != "b" && +test "$(cat c)" != "c" + +# Add only the changes of a and c, and make a commit! Finally, make a commit which captures the changes in b! + +test "$(git show main:a)" != "a" && +test "$(git show main:b)" != "b" && +test "$(git show main:c)" != "c" && +test "$(git show main^:a)" != "a" && +test "$(git show main^:b)" == "b" && +test "$(git show main^:c)" != "c" + +[congrats] + +Well done! Try tavelling between the commits using `git checkout`, so you can look at their contents again! diff --git a/levels/it/index/change b/levels/it/index/change new file mode 100644 index 0000000..970ffd6 --- /dev/null +++ b/levels/it/index/change @@ -0,0 +1,31 @@ +title = Aggiornare i file nell'indice +cards = add commit + +[description] + +Quando cambiamo i files l'indice non cambia da solo. Dobbiamo usare `git add` per aggiornare l'indice alla nuova versione del file.. + +Proviamoci! + +Le icone nel file manager ti mostrano quando il file attuale (bianco) e la versione nell'indice (blu) differiscono o sono uguali! + +[win] + +Bene! L'indice è anche chiamato "staging area" (area di staging) - E contiene esattamente ciò che finisce nel prossimo commit quando usi `git commit`! + +[setup] + +echo "La candela brucia con una fiamma blu." > candle +git add . +git commit -m "L'inizio" + +[win] + +# Fai una modifica alla candela +test "$(git diff --name-only)" = "candle" || file -f .git/candle-changed && touch .git/candle-changed + +# Aggiungi la candella. +test "$(git diff --cached --name-only)" = "candle" || file -f .git/candle-added && touch .git/candle-added + +# Fai un commit. +test "$(git diff --name-only HEAD HEAD^)" = "candle" diff --git a/levels/it/index/checkout b/levels/it/index/checkout new file mode 100644 index 0000000..3c01b09 --- /dev/null +++ b/levels/it/index/checkout @@ -0,0 +1,25 @@ +title = Checking out files from the index +cards = add reset-file checkout-file commit + +[description] + +So you've made changes to your files, but you decide that you don't want to keep them! You can use `git checkout` for that! + +What happens if you have already update the index, like in file c? You have to reset the index first! + +[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 +git add c + +[win] + +# Remove all changes in your local files! +test "$(git diff --name-only | wc -l)" -eq 0 diff --git a/levels/it/index/compare b/levels/it/index/compare new file mode 100644 index 0000000..557b654 --- /dev/null +++ b/levels/it/index/compare @@ -0,0 +1,51 @@ +title = Passo dopo passo +cards = checkout commit-auto + +[description] + +Benvenuto! nella lezione di oggi impareremo come creare commits con più precisione! + +Dai un'occhiata a queste due linee temporali. Hanno lo stesso risultato, ma in una delle due è molto più semplice capire cosa è successo. + +[win] + +# Esatto! Avere ogni cambiamento nel proprio commit rende più facile capire cosa sta succedendo! +git branch --show-current | grep step-by-step + +[setup] + +echo "Una piccola ma pesante palla di vetro." > ball +echo "Un sottile libro che sta in piedi." > book +echo "Una candela brucia con una fiamma blu." > candle +echo "Un sensore di fumo. E' assolutamente silenzioso." > smoke_detector + +git add . +git commit -m "L'inizio" + +git branch -M all-at-once + +echo "La palla adesso tocca il libro." > ball +echo "Il libro è caduto." > book +echo "La candella è stata spenta." > candle + +git commit -am "La fine" + +git checkout HEAD^ + +git checkout -b step-by-step + +echo "La palla adesso tocca il libro." > ball +git commit -am "La palla rotola verso il libro" + +echo "Il libro è caduto." > book +git commit -am "Il libro è caduto" + +echo "La candela è stata spenta." > candle +git commit -am "Il libro ha spento la candela" + +git checkout HEAD~3 + +[win] + +# Prendi la sequenza temporale più chiara e fai suonare il sensore di fumo! +git show step-by-step:smoke_detector | tail -n 1 | grep -v "assolutamente silenzioso" diff --git a/levels/it/index/new b/levels/it/index/new new file mode 100644 index 0000000..4ce39ec --- /dev/null +++ b/levels/it/index/new @@ -0,0 +1,28 @@ +title = Aggiungere nuovi file all'indice +cards = add commit + +[description] + +Finora, quando abbiamo eseguito un commit abbiamo sempre registrato lo stato di tutti gli oggetti, vero? + +Ma Git ti permette di scegliere i cambiamenti che si vogliono mettere in un commit! + +Per sapere come funziona, dobbiamo conoscere l'"indice"! Nell'indice, possiamo preparare ciò che sarà nel prossimo commit. In questo gioco, l'indice è rappresentato da un'aura blu attorno alle icone nel file manager! + +Inizialmente, l'indice è vuoto. Per fare un commit che contenga un nuovo file, dobbiamo aggiungerlo! + +[cli] + +Puoi usare il completamento con la tabulazione nel terminale! Inizia a scrivere il nome di un file e premi il tasto tab per completarlo. Così risparmi tempo! + +[setup] + +echo "La candela brucia con una fiamma blu." > candle + +[win] + +# Aggiungi la candela. +test "$(git diff --cached --name-only)" = "candle" || file -f .git/candle-added && touch .git/candle-added + +# Crea un commit. +test "$(git ls-tree --name-only HEAD)" = "candle" diff --git a/levels/it/index/reset b/levels/it/index/reset new file mode 100644 index 0000000..fd118fd --- /dev/null +++ b/levels/it/index/reset @@ -0,0 +1,37 @@ +title = Resettare i file nell'indice +cards = add reset-file commit + +[description] + +Vedi l'ombra scura dietro le icone? Questa è la versione del file nell'ultimo commit! + +Per esempio, queste candele sono state spente e quella modifica è stata aggiunta! + +Ma è stato un errore! Vuoi solo spegnere al candela rossa nel prossimo commit! + +Se hai già aggiunto un file modificato all'indice ma vuoi ripristinarlo, puoi usare `git reset`! + +[setup] + +echo "Sta bruciando!" > red_candle +echo "Sta bruciando!" > green_candle +echo "Sta bruciando!" > blue_candle +git add . +git commit -m "L'inizio" + +echo "È stata spenta." > red_candle +echo "È stata spenta." > green_candle +echo "È stata spenta." > blue_candle +git add . + +[win] + +# Ripristina i cambiamenti nella candela verde e in quella blu! +git show :green_candle | grep burning && +git show :blue_candle | grep burning && +git show :red_candle | grep -v burning + +# E fai un commit +git show main:green_candle | grep burning && +git show main:blue_candle | grep burning && +git show main:red_candle | grep -v burning diff --git a/levels/it/index/rm b/levels/it/index/rm new file mode 100644 index 0000000..637fd22 --- /dev/null +++ b/levels/it/index/rm @@ -0,0 +1,24 @@ +title = Delete a file in the next commit +cards = add reset-file checkout-file rm file-delete commit + +[description] + +If you want to remove a file in the next commit, you can use `git rm`! This will both delete the file locally, and in the index. + +If a file is modified, you'll need to reset these changes first/reset the files. + +[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 + +[win] + +# Make a commit where all files are deleted ¯\_(^_^)_/¯ +test "$(git ls-tree main | wc -l)" -eq 0 diff --git a/levels/it/index/sequence b/levels/it/index/sequence new file mode 100644 index 0000000..42f7f48 --- /dev/null +++ b/levels/it/index/sequence @@ -0,0 +1,5 @@ +compare +new +change +reset +steps diff --git a/levels/it/index/steps b/levels/it/index/steps new file mode 100644 index 0000000..8c13af7 --- /dev/null +++ b/levels/it/index/steps @@ -0,0 +1,53 @@ +title = Aggiungere le modifice una per volta +cards = add reset-file commit + +[description] + +L'indice è veramente utile perché ci permette di essere precisi su quali cambiamenti vogliamo includere in ogni commit! + +[setup] + +echo "Un martello, in equilibrio sul suo manico." > hammer +echo "Una bottiglia contenente un liquido trasparente." > bottle +echo "Un cubetto di zucchero bianco." > sugar_cube + +git add . +git commit -m "L'inizio" + +[win] + +# Fai dei cambiamenti a tutti e tre gli oggetti per creare una sequenza logica di eventi! +test "$(git diff --name-only | wc -l)" -eq 3 || file -f .git/candle-changed && touch .git/candle-changed + +# Aggiungi solo uno dei cambiamenti! +test "$(git diff --cached --name-only | wc -l)" -eq 1 || file -f .git/candle-added && touch .git/candle-added + +# E fai un commit +COUNT=0 +for commit in $(git cat-file --batch-check='%(objectname) %(objecttype)' --batch-all-objects | grep 'commit$' | cut -f1 -d' '); do + if test "$(git diff --name-only $commit $commit^ | wc -l)" -eq 1; then + COUNT=$((COUNT+1)) + fi +done + +test "$COUNT" -ge 1 + +# Fai un secondo commit che registri solo un singolo cambiamento. +COUNT=0 +for commit in $(git cat-file --batch-check='%(objectname) %(objecttype)' --batch-all-objects | grep 'commit$' | cut -f1 -d' '); do + if test "$(git diff --name-only $commit $commit^ | wc -l)" -eq 1; then + COUNT=$((COUNT+1)) + fi +done + +test "$COUNT" -ge 2 + +# E aggiungine un terzo. +COUNT=0 +for commit in $(git cat-file --batch-check='%(objectname) %(objecttype)' --batch-all-objects | grep 'commit$' | cut -f1 -d' '); do + if test "$(git diff --name-only $commit $commit^ | wc -l)" -eq 1; then + COUNT=$((COUNT+1)) + fi +done + +test "$COUNT" -ge 3 diff --git a/levels/it/intro/cli b/levels/it/intro/cli new file mode 100644 index 0000000..c643fc1 --- /dev/null +++ b/levels/it/intro/cli @@ -0,0 +1,27 @@ +title = La line di comando +cards = + +[description] + +Queste carte da gioco sono state disegnate per essere usate e ricordate facilmente! Ti consigliamo di attenerti a loro se non hai molta esperienza di Git! + +[cli] + +Ma c'è un'altra via per interagire con Git: + +Prova a digitare `git init` nel terminale qui sotto e premere il pulsante Enter! + +[setup] + +rm -rf .git + +[win] + +# Inizializza la macchina del tempo! +test -d .git + +[congrats] + +Perfetto! Al posto di usare le carte da gioco, puoi anche fare tutto dalla line di comando! + +La line di comando e piuttosto potente! A volte, puoi usarla per risolvere le attività più velocemente che con l'interfaccia grafica. diff --git a/levels/it/intro/commit b/levels/it/intro/commit new file mode 100644 index 0000000..1141ae1 --- /dev/null +++ b/levels/it/intro/commit @@ -0,0 +1,32 @@ +title = Il tuo primo commit! +cards = commit-auto + +[description] + +Puoi usare la tua macchina del tempo per scattare istantanee degli oggetti intorno a te! Qui puoi metterlo in pratica! + +(Il tuo insegnante versa un pò di acqua nel bicchiere) + +[cli] +Nuovamente, al posto di usare le carte, puoi scrivere i comandi, che sono stampati sulle carte, nel terminale in basso! + +Questo è totalmente opzionale! Ma questa è una conoscenza super utile nel mondo reale - e ti farà avere un distintivo scintillante! :) + +[setup] + +echo "Il bicchiere è pieno di acqua." > glass + +[win] + +# Crea un'istantanea del bicchiere (un "commit") +git rev-parse HEAD + +# Cambia il contenuto del bicchiere! +! test "$(cat glass)" = "Il bicchiere è pieno di acqua." + +# E crea un secondo "commit"! +git rev-parse HEAD^ && ! test "$(git show main:glass)" = "Il bicchiere è bieno di acqua." + +[congrats] + +Perfetto! Puoi provare a creare altri "commit". Quando ti sentirai a posto, premi su "Next Level". diff --git a/levels/it/intro/copies b/levels/it/intro/copies new file mode 100644 index 0000000..8f8d6ce --- /dev/null +++ b/levels/it/intro/copies @@ -0,0 +1,42 @@ +title = Crea una copia +cards = + +[description] + +Questa volta, stai facendo molte copie di backup - puoi guardarli cliccandoci sopra! + +[congrats] + +Okay, questo è un modo di lavorare. + +Ma sei preoccupato che ti ritroverai con centinaia di copie di questo modulo e sarà difficile tenerne traccia nel tempo. + +Specialmente quando lavori con altre persone, inviare copie avanti ed indietro non sembra l'ideale. + +Fermati, devi provare questa macchina del tempo! + +[setup] + +rm -rf .git + +echo "~ Perchè voglio imparare Git ~ + +(Devo ancora scriverlo.)" >> form.txt + + +echo "~ Perchè volgio imparare Git ~ + +- Così posso annullare gli errori" >> form2.txt + + +echo "~ Perchè volgio imparare Git ~ + +- Così posso annullare gli errori +- Per tracciare i mie progetti attraverso il tempo" >> form2_final.txt + +cp form2_final.txt form2_really_final.txt + +[win] + +# Aggiungi una nuova line al file form2_really_final.txt! +test "$(cat form2_really_final.txt | wc -l )" -ge 5 diff --git a/levels/it/intro/init b/levels/it/intro/init new file mode 100644 index 0000000..260f6e9 --- /dev/null +++ b/levels/it/intro/init @@ -0,0 +1,24 @@ +title = Entra nella machina del tempo +cards = init + +[description] + +Sei stato accettato nella scuola della macchina del tempo! Questo è il tuo primo giorno! Il tuo insegnate ti spiega: + +"Per fare qualsiasi cosa con una macchina del tempo, devi prima inizializzarla!" + +Trascina quella carta blu verso l'alto per usarla! + +[setup] + +rm -rf .git + +[win] + +# Inizializzazione della macchina del tempo +test -d .git + +[congrats] + +Perfetto! Vedi quel piccolo animale che è apparso? Sarà il tuo compagno e ti mostrerà dove ti trovi nel tempo! + diff --git a/levels/it/intro/remote b/levels/it/intro/remote new file mode 100644 index 0000000..c0b582a --- /dev/null +++ b/levels/it/intro/remote @@ -0,0 +1,52 @@ +title = Dai lavoriamo tutti assieme +cards = pull commit-auto push + +[description] + +Aggiungi il tuo nome nella nostra lista di studenti! + +Ho già un secondo "commit" nella mia macchina del tempo - Dai lavoriamo tutti assieme! + +[cli] + +Per tornare in dietro alle vecchie istruzioni, puoi premere la freccia in alto o in basso. In questo modo non devi digitare, nuovamente, le istruzioni. + +[congrats] + +Benvenuto nella scuola del viaggio nel tepo! :) Ci vediamo domani per la tua prima lezione! + +[setup] + +echo "~ Lista degli attuali studenti ~" > students +git add . +git commit -m "Versione iniziale" +git push -u teacher main + +git update-ref -d refs/remotes/teacher/main + +[setup teacher] + +git reset --hard main + +echo " +- Sam +- Alex" >> students + +git add . +git commit -m "Aggiunti due studenti" + +[win] + +# Ottieni il secondo "commit" dal tuo insegnante usando `git pull`. +test "$(git log --oneline teacher/main | wc -l)" -ge 2 + +# Aggiungi il tuo nome alla lista degli studenti. +test "$(cat students |wc -l)" -ge 5 + +# Crea un'istantanea dei risultati. +test "$(git show main:students |wc -l)" -ge 5 + +[win teacher] + +# E usa `git push` per inviarlo al tuo insegnante! +test "$(git show main:students |wc -l)" -ge 5 diff --git a/levels/it/intro/risky b/levels/it/intro/risky new file mode 100644 index 0000000..57a52d1 --- /dev/null +++ b/levels/it/intro/risky @@ -0,0 +1,42 @@ +title = Vivere è pericoloso +cards = + +[description] + +Quindi hai deciso di fare domanda per la scuola di viaggio nel tempo, per usare la macchina del tempo chiamata "Git"! + +Che emozione! + +Hai quasi concluso le scartoffie! Devi solamente inserire un motivo per il quale vuoi imparare Git. + +[congrats] + +All'improvviso, il tuo gatto salta sul tavolo, strappa via il modulo, e scappa via! Oh no. Tutto il tuo duro lavoro, andato! + +Devi trovare una buona soluzione. + +(Premi "Prossimo livello" appena sei pronto!) + +[setup] + +rm -rf .git + +echo "~ Perchè voglio imparare Git ~ + +- Così posso cancellare gli errori +- Per seguire il mio progetto attraverso il tempo" >> form.txt + +[actions] + +test "$(cat form.txt | wc -l )" -ge 5 && echo "(E' stato rubato dal tuo gatto.) + + + + + +" > form.txt + +[win] + +# Aggiungi un'altra line a form.txt! +test "$(cat form.txt | wc -l )" -ge 5 diff --git a/levels/it/intro/sequence b/levels/it/intro/sequence new file mode 100644 index 0000000..aa225df --- /dev/null +++ b/levels/it/intro/sequence @@ -0,0 +1,6 @@ +risky +copies +init +cli +commit +remote diff --git a/levels/it/intro/who-are-you b/levels/it/intro/who-are-you new file mode 100644 index 0000000..abb94f3 --- /dev/null +++ b/levels/it/intro/who-are-you @@ -0,0 +1,38 @@ +title = Benvenuto nella scuola del viaggio nel tempo! +cards = config-name commit-auto checkout + +[description] + +Sei ancora confuso da tutto quello che sta succedendo. Il giorno seguente, decidi di iscriverti nella scuola del viaggio nel tempo! + +Il tuo insegnante del viaggio nel tempo ti saluta: "Ciao come va! Vuoi dirci il tuo nome?" + +[setup] + +git config --global user.name "TU" + +echo "~ Chi vuole imparare come si usa la macchina del tempo? ~ + +[ ] Per essere sicuro che il mio gatto non mangi il mio lavoro. +[ ] Così non devo tenere copie di tutti i miei saggi. +[ ] Per collaborare con altri studenti del viaggio nel tempo. +[ ] Altro, perfavore specifica:" > form + +[actions] + +test "$(git config user.name)" != "TU" && cat form | grep -v Signature && echo " +Firma: $(git config user.name)" >> form + +[win] + +# Presentati. +test "$(git config user.name)" != "TU" + +# Compila l'iscrizione e inviala! +git show main:form | grep '\[[xX]\]' + +[congrats] + +"Siamo lieti di averti con noi! + +Git puoi aiutarti a correggere i problemi del passato! Ti aiuta a collaborare con gli studenti del viaggio nel tempo! E' davvero potente e e popolare! Ci vediamo domani per la tua prima lezione!" diff --git a/levels/it/low-level/basics b/levels/it/low-level/basics new file mode 100644 index 0000000..55374b5 --- /dev/null +++ b/levels/it/low-level/basics @@ -0,0 +1,26 @@ +[description] + +For this prototype, we assume you have some experience with the command line. Here are some commands that will be useful: + +- ls +- echo content > file +- cat file +- mkdir dir + +Find the riddle in your current directory and put the answer into the file "answer"! + +[congrats] + +Omnomnom! + +For technical reasons, you can't use `cd` in this prototype yet. But there won't be a lot of interaction with the file system anyways. :) + +[setup] + +mkdir riddle +echo "ppl p" > riddle/consonants +echo "ae ie" > riddle/vowels + +[win] + +cat answer | grep -i "apple \\?pie" diff --git a/levels/it/low-level/blob-create b/levels/it/low-level/blob-create new file mode 100644 index 0000000..86f6254 --- /dev/null +++ b/levels/it/low-level/blob-create @@ -0,0 +1,38 @@ +[description] + +At its core, Git is very simple. It stores "objects", which are basically files identified by an "identifier" (short: ID). + +There are four types of objects: blobs, trees, commits, and tags. The simplest type is a "blob", which is just a piece of text. + +Let's create some blobs! To do that, create a file with the desired content, and then use + + git hash-object -w + +The flag -w means "write", and tells Git to actually write the new blob to the disk. + +Create three new blobs! + +[congrats] + +Tip: You can also use a command like this to create a blob in a single line: + + echo "awesome content" | git hash-object -w --stdin + +Did you already notice that you can drag and drop all objects? :) + +[setup] + +[setup goal] + +echo "Hi" > file1 +echo "Ho" > file2 +echo "Hu" > file3 +git hash-object -w file1 +git hash-object -w file2 +git hash-object -w file3 + +[win] + +BLOB_COUNT=$(git cat-file --batch-check='%(objectname) %(objecttype)' --batch-all-objects | grep blob | wc -l) + +test "$BLOB_COUNT" -gt 2 diff --git a/levels/it/low-level/blob-remove b/levels/it/low-level/blob-remove new file mode 100644 index 0000000..bbc1b30 --- /dev/null +++ b/levels/it/low-level/blob-remove @@ -0,0 +1,27 @@ +[description] + +There's a simple command to remove all objects that are not referenced by anything: + + git prune + +Remove all blobs in this repository. + +[congrats] + +Generally, `git prune` will be useful if you want to clean up some objects you made. + +Alternatively, you can also click the "Reload" button to restart a level. + +[setup] + +echo "My master password is a1b2c3d4e5" | git hash-object -w --stdin +echo "This blob really should not exist" | git hash-object -w --stdin +echo "This is a virus" | git hash-object -w --stdin + +[setup goal] + +[win] + +OBJECT_COUNT=$(git cat-file --batch-check='%(objectname) %(objecttype)' --batch-all-objects | wc -l) + +test "$OBJECT_COUNT" -eq 0 diff --git a/levels/it/low-level/commit-create b/levels/it/low-level/commit-create new file mode 100644 index 0000000..79a8e52 --- /dev/null +++ b/levels/it/low-level/commit-create @@ -0,0 +1,37 @@ +[description] + +So a tree describes a directory structure at a specific point in time. + +It would be nice if we could remember when that state existed, and who authored it, right? + +Enter: commits. They are objects that point to a tree and contain some additional metadata. You can create a commit using + + git commit-tree -m "Description of your commit" + +Make a commit from the tree in this repository! + +[setup] + +touch empty_file +git add . +git write-tree + +rm empty_file +git update-index --remove empty_file + +[setup goal] + +touch empty_file +git add . +git write-tree + +rm empty_file +git update-index --remove empty_file + +git commit-tree 3185 -m 'Clever commit message' + +[win] + +COMMIT_COUNT=$(git cat-file --batch-check='%(objectname) %(objecttype)' --batch-all-objects | grep commit | wc -l) + +test "$COMMIT_COUNT" -gt 0 diff --git a/levels/it/low-level/commit-parents b/levels/it/low-level/commit-parents new file mode 100644 index 0000000..a2efb11 --- /dev/null +++ b/levels/it/low-level/commit-parents @@ -0,0 +1,31 @@ +[description] + +When using the commit-tree command, you can optionally specify a parent: + + git commit-tree -m "Description" -p + +Make a string of three commits! + +Hint: You'll need a tree object. What could be the easiest way to obtain one? + +[setup] + +[setup goal] + +git write-tree +FIRST_COMMIT=$(git commit-tree 4b82 -m 'First commit :O') +SECOND_COMMIT=$(git commit-tree 4b82 -p $FIRST_COMMIT -m 'Second commit :D') +THIRD_COMMIT=$(git commit-tree 4b82 -p $SECOND_COMMIT -m 'Third commit \o/') + +[win] + +COMMITS=$(git cat-file --batch-check='%(objectname) %(objecttype)' --batch-all-objects | grep commit | cut -f1 -d" ") + +for COMMIT in $COMMITS; do + echo a commit named $COMMIT + if [ $(git rev-list $COMMIT | wc -l) -ge 3 ]; then + return 0 + fi +done + +return 1 diff --git a/levels/it/low-level/commit-rhombus b/levels/it/low-level/commit-rhombus new file mode 100644 index 0000000..e320ca0 --- /dev/null +++ b/levels/it/low-level/commit-rhombus @@ -0,0 +1,30 @@ +[description] + +A commit can have multiple parents! You can specify the -p option multiple times, like this: + + git commit-tree -m "Description" -p -p + +Build a rhombus shape from commits, where two commits point to the same parent, and then a fourth commit points to both of them. + +[setup] + +[setup goal] + +TREE=$(git write-tree) +SOUTH=$(git commit-tree $TREE -m "South") +EAST=$(git commit-tree $TREE -m "East" -p $SOUTH) +WEST=$(git commit-tree $TREE -m "West" -p $SOUTH) +NORTH=$(git commit-tree $TREE -m "Nort" -p $EAST -p $WEST) + +[win] + +COMMITS=$(git cat-file --batch-check='%(objectname) %(objecttype)' --batch-all-objects | grep commit | cut -f1 -d" ") + +for COMMIT in $COMMITS; do + # My first parent's parents has to be the same as my second parent's parent. + if [ "$(git rev-parse --verify -q $COMMIT^1^)" = "$(git rev-parse --verify -q $COMMIT^2^)" ]; then + return 0 + fi +done + +return 1 diff --git a/levels/it/low-level/index-add b/levels/it/low-level/index-add new file mode 100644 index 0000000..633245c --- /dev/null +++ b/levels/it/low-level/index-add @@ -0,0 +1,37 @@ +[description] + +Blobs usually represent the content of a file. But on their own, they don't have any metadata, not even a name! + +Git has a very powerful concept to store metadata related to blobs: the index! It's a list that relates blobs to filenames and access permissions. + +The most convenient option to add an entry to the index is via an existing file: + + echo "my content" > file + git update-index --add file + +Add three entries to the index! For a bonus challenge: can you add a file that is inside of a directory, like "directory/file"? + +[congrats] + +There's another way to add an entry to the index directly: + + git update-index --add --cacheinfo ,, + +The first three numbers of the mode describe the type of the entry, "100" is a regular file. + +The second three number describe the permissions. Only "644" (non-executable) and "755" (executable) are supported. + +You can insert the hash of an object into the terminal by right-clicking on it! :) + +[setup] + +[setup goal] + +echo "file 1" > file1 +echo "file 2" > file2 +echo "file 3" > file3 +git add . + +[win] + +test "$(git ls-files | wc -l)" -ge 3 diff --git a/levels/it/low-level/index-remove b/levels/it/low-level/index-remove new file mode 100644 index 0000000..9816126 --- /dev/null +++ b/levels/it/low-level/index-remove @@ -0,0 +1,29 @@ +[description] + +To remove an entry from the index, use a command like this: + + git update-index --force-remove + +Remove all entries from the index! + +[setup] + +echo "file 1" > file1 +echo "file 2" > file2 +echo "file 3" > file3 +git add . + +[setup goal] + +echo "file 1" > file1 +echo "file 2" > file2 +echo "file 3" > file3 +git add . + +git update-index --force-remove file1 +git update-index --force-remove file2 +git update-index --force-remove file3 + +[win] + +test "$(git ls-files | wc -l)" -eq 0 diff --git a/levels/it/low-level/index-update b/levels/it/low-level/index-update new file mode 100644 index 0000000..047493d --- /dev/null +++ b/levels/it/low-level/index-update @@ -0,0 +1,33 @@ +[description] + +Instead of removing an entry from the index and adding one with the same name, you can also directly update that entry! + +Put the content you want in a file with a matching name, and then run + + git update-index + +This will create a new blob, and update the hash of the entry to that blob. + +Update an entry in the index! + +[setup] + +echo "file 1" > file1 +echo "file 2" > file2 +echo "file 3" > file3 +git add . + +[setup goal] + +echo "file 1" > file1 +echo "file 2" > file2 +echo "file 3" > file3 +git add . + +echo "new content" > file1 +git update-index file1 + +[win] + +# This is not really a good test for the winning condition... +test "$(git ls-files -s | git hash-object --stdin)" != "10c4b28623e7e44e09f5a596450a50ab7ac31fbe" -a "$(git ls-files | wc -l)" -eq 3 diff --git a/levels/it/low-level/puzzle-apocalypse b/levels/it/low-level/puzzle-apocalypse new file mode 100644 index 0000000..119784d --- /dev/null +++ b/levels/it/low-level/puzzle-apocalypse @@ -0,0 +1,41 @@ +[description] + +Delete all objects in this repository using git commands only! + +Useful commands: + + git prune + git reflog expire + +[setup] + +echo foo > foo +BLOB=$(git hash-object -w foo) +echo bar > bar +git add . +git commit -m "Initial commit" +echo blabber >> bar +git commit -a -m "Second commit" +git update-ref refs/important HEAD +git update-ref refs/interesting "$BLOB" + +[setup goal] + +echo foo > foo +BLOB=$(git hash-object -w foo) +echo bar > bar +git add . +git commit -m "Initial commit" +echo blabber >> bar +git commit -a -m "Second commit" +git update-ref refs/important HEAD +git update-ref refs/interesting "$BLOB" + +TREE=$(git mktree) +git read-tree $TREE +rm -rf .git/refs/* +rm -rf .git/objects/* + +[win] + +test "$(git cat-file --batch-check --batch-all-objects | wc -l)" -eq 0 diff --git a/levels/it/low-level/puzzle-precious-blob b/levels/it/low-level/puzzle-precious-blob new file mode 100644 index 0000000..865cfdf --- /dev/null +++ b/levels/it/low-level/puzzle-precious-blob @@ -0,0 +1,28 @@ +[description] + +Create two trees pointing to the same blob! + +[setup] + +[setup goal] + +BLOB=$(echo "I am precious" | git hash-object -w --stdin) +git update-index --add --cacheinfo 100644,$BLOB,a +git write-tree +git update-index --force-remove a +git update-index --add --cacheinfo 100644,$BLOB,b +git write-tree +git update-index --force-remove b + +[win] + +TREES=$(git cat-file --batch-check='%(objectname) %(objecttype)' --batch-all-objects | grep tree | cut -f1 -d" ") + +ALL_TREE_CHILDREN=$(for TREE in $TREES; do + git cat-file -p $TREE | cut -f1 | cut -f3 -d" " +done) + +NUMBER_OF_CHILDREN=$(echo "$ALL_TREE_CHILDREN" | wc -l) +UNIQUE_CHILDREN=$(echo "$ALL_TREE_CHILDREN" | sort -u | wc -l) + +test "$NUMBER_OF_CHILDREN" -gt "$UNIQUE_CHILDREN" diff --git a/levels/it/low-level/puzzle-trees-all-the-way-down b/levels/it/low-level/puzzle-trees-all-the-way-down new file mode 100644 index 0000000..bc3e58a --- /dev/null +++ b/levels/it/low-level/puzzle-trees-all-the-way-down @@ -0,0 +1,34 @@ +[description] + +Construct a chain of three trees, which don't point to anything else. + +This is hard! The `git mktree` command might be useful. + +[setup] + +[setup goal] + +git mktree +TREE=$(echo -e "040000 tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904\tdir" | git mktree) +echo -e "040000 tree $TREE\tdir" | git mktree + +[win] + +TREES=$(git cat-file --batch-check='%(objectname) %(objecttype)' --batch-all-objects | grep tree | cut -f1 -d" ") + +for TREE in $TREES; do + if [ "$(git cat-file -p $TREE | wc -l)" -eq 1 ]; then + if [ "$(git cat-file -p $TREE | cut -f1 | grep tree | wc -l)" -eq 1 ]; then + # So the tree has exactly one child, and it is a tree! + TREE2=$(git cat-file -p $TREE | cut -f1 | grep tree | cut -f3 -d" ") + if [ "$(git cat-file -p $TREE2 | wc -l)" -eq 1 ]; then + if [ "$(git cat-file -p $TREE2 | cut -f1 | grep tree | wc -l)" -eq 1 ]; then + # Same for its child! \o/ + return 0 + fi + fi + fi + fi +done + +return 1 diff --git a/levels/it/low-level/ref-create b/levels/it/low-level/ref-create new file mode 100644 index 0000000..1cc4bcf --- /dev/null +++ b/levels/it/low-level/ref-create @@ -0,0 +1,42 @@ +[description] + +Let's take a look at "refs" (short for "references")! Refs are not objects, but rather very simple *pointers* to objects! They can help you keep track of what's where. + +You can create or update a ref with + + git update-ref refs/ + +Make sure to always start a ref's name with "refs/"! That's a convention that helps Git find all refs you create. If you forget the "refs/", you will not see the ref. + +Create refs that point to all objects in this repository! + +[setup] + +echo hello > hello +echo world > world +BLOB1=$(git hash-object -w hello) +BLOB2=$(git hash-object -w world) +git add . +TREE=$(git write-tree) +COMMIT=$(git commit-tree $TREE -m "Initial commit") + +[setup goal] + +echo hello > hello +echo world > world +BLOB1=$(git hash-object -w hello) +BLOB2=$(git hash-object -w world) +git add . +TREE=$(git write-tree) +COMMIT=$(git commit-tree $TREE -m "Initial commit") + +git update-ref refs/a $BLOB1 +git update-ref refs/b $BLOB2 +git update-ref refs/c $TREE +git update-ref refs/d $COMMIT + +[win] + +OBJECTS=$(git cat-file --batch-check='%(objectname)' --batch-all-objects | sort) +REF_TARGETS=$(git show-ref -s | sort | uniq) +test "$OBJECTS" = "$REF_TARGETS" diff --git a/levels/it/low-level/ref-move b/levels/it/low-level/ref-move new file mode 100644 index 0000000..e3b29e3 --- /dev/null +++ b/levels/it/low-level/ref-move @@ -0,0 +1,41 @@ +[description] + +You can point refs to a new location using the same command you use to create them: + + git update-ref refs/ + +As an exercise, make all refs in this repository point to the tree object! + +[setup] + +echo hello > hello +echo world > world +BLOB1=$(git hash-object -w hello) +BLOB2=$(git hash-object -w world) +git add . +TREE=$(git write-tree) +COMMIT=$(git commit-tree $TREE -m "Initial commit") + +git update-ref refs/a "$BLOB1" +git update-ref refs/b "$COMMIT" + +[setup goal] + +echo hello > hello +echo world > world +BLOB1=$(git hash-object -w hello) +BLOB2=$(git hash-object -w world) +git add . +TREE=$(git write-tree) +COMMIT=$(git commit-tree $TREE -m "Initial commit") + +git update-ref refs/a "$BLOB1" +git update-ref refs/b "$COMMIT" + +for REF in $(git for-each-ref --format='%(refname)'); do + git update-ref "$REF" "$TREE" +done + +[win] + +test "$(git show-ref -s | sort -u)" = "c7863f72467ed8dd44f4b8ffdb8b57ca7d91dc9e" diff --git a/levels/it/low-level/ref-remove b/levels/it/low-level/ref-remove new file mode 100644 index 0000000..d1fa982 --- /dev/null +++ b/levels/it/low-level/ref-remove @@ -0,0 +1,41 @@ +[description] + +And finally, to delete a ref, use + + git update-ref -d refs/ + +Delete all refs! :P (Well, except for HEAD. HEAD is special.) + +[setup] + +echo hello > hello +echo world > world +BLOB1=$(git hash-object -w hello) +BLOB2=$(git hash-object -w world) +git add . +TREE=$(git write-tree) +COMMIT=$(git commit-tree $TREE -m "Initial commit") + +git update-ref refs/best_blob_ever "$BLOB1" +git update-ref refs/beautiful_commit "$COMMIT" + +[setup goal] + +echo hello > hello +echo world > world +BLOB1=$(git hash-object -w hello) +BLOB2=$(git hash-object -w world) +git add . +TREE=$(git write-tree) +COMMIT=$(git commit-tree $TREE -m "Initial commit") + +git update-ref refs/best_blob_ever "$BLOB1" +git update-ref refs/beautiful_commit "$COMMIT" + +for REF in $(git for-each-ref --format='%(refname)'); do + git update-ref -d "$REF" +done + +[win] + +test "$(git show-ref | wc -l)" -eq 0 diff --git a/levels/it/low-level/sequence b/levels/it/low-level/sequence new file mode 100644 index 0000000..5feb0c8 --- /dev/null +++ b/levels/it/low-level/sequence @@ -0,0 +1,18 @@ +welcome +basics +blob-create +blob-remove +index-add +index-remove +index-update +tree-create +tree-read +tree-nested +commit-create +commit-parents +commit-rhombus +ref-create +ref-move +ref-remove +symref-create +symref-no-deref diff --git a/levels/it/low-level/symref-create b/levels/it/low-level/symref-create new file mode 100644 index 0000000..da933cb --- /dev/null +++ b/levels/it/low-level/symref-create @@ -0,0 +1,21 @@ +[description] + +Instead of pointing directly to objects, refs can also point to other refs! + +When that happens, they are called "symbolic refs". You can create or update a symbolic ref using + + git symbolic-ref + +Create a symbolic ref called "refs/rainbow"! + +[setup] + +[setup goal] + +BLOB=$(git hash-object -w --stdin) +git update-ref refs/double "$BLOB" +git symbolic-ref refs/rainbow refs/double + +[win] + +git symbolic-ref refs/rainbow diff --git a/levels/it/low-level/symref-no-deref b/levels/it/low-level/symref-no-deref new file mode 100644 index 0000000..458e669 --- /dev/null +++ b/levels/it/low-level/symref-no-deref @@ -0,0 +1,46 @@ +[description] + +When you have a symbolic ref (a ref pointing at another ref), and you decide you want it to be a regular ref again (pointing to an object), you're in for some trouble! :) + +What happens when you try pointing the symbolic ref directly to the blob using `git update-ref`? + +Oops! Turns out that when you reference a symbolic ref, it acts as if you had specified the ref it points to. To de-symbolic-ize it, use the `--no-deref` option directly after `update-ref`! + +Weird, huh? + +[congrats] + +Whew, we've covered a lot of things: Blobs! The index! Trees! Commits! Refs! + +You now know about almost everything about how Git repositories look like on the inside! We think that's pretty cool! :) + +Everything else is just convention and high-level commands that make interacting with the objects more convenient. + +We haven't covered: + +- tag objects (they are the fourth object type - a bit like refs with a description and an author) +- configuration (allows you to specify remote repositories, for example) +- working with local files (which is, uh, arguably pretty important :P) + +Thanks for playing! You're welcome to check out the "puzzle" levels in the dropdown, some of them are more advanced! + +[setup] + +BLOB1=$(echo delicious | git hash-object -w --stdin) +BLOB2=$(echo very | git hash-object -w --stdin) +git update-ref refs/curly "$BLOB1" +git symbolic-ref refs/fries refs/curly + +[setup goal] + +BLOB1=$(echo delicious | git hash-object -w --stdin) +BLOB2=$(echo very | git hash-object -w --stdin) +git update-ref refs/curly "$BLOB1" +git symbolic-ref refs/fries refs/curly + +git update-ref --no-deref refs/fries "$BLOB2" + +[win] + +git symbolic-ref refs/fries && return 1 +test "$(git show-ref -s refs/fries)" = "035e2968dafeea08e46e8fe6743cb8123e8b9aa6" diff --git a/levels/it/low-level/tree-create b/levels/it/low-level/tree-create new file mode 100644 index 0000000..3da3618 --- /dev/null +++ b/levels/it/low-level/tree-create @@ -0,0 +1,35 @@ +[description] + +After carefully building the index we want, it would be nice to save a permanent snapshot of it, right? + +This is what the second type of objects is for: trees! You can convert the index into a tree using + + git write-tree + +Try it! :) + +[congrats] + +Nice! + +Can you make a different tree? Modify the index, then call `git write-tree` again! + +[setup] + +echo "file 1" > file1 +echo "file 2" > file2 +echo "file 3" > file3 +git add . + +[setup goal] + +echo "file 1" > file1 +echo "file 2" > file2 +echo "file 3" > file3 +git add . + +git write-tree + +[win] + +git cat-file -p 21a638f28022064c1f1df20844278b494d197979 diff --git a/levels/it/low-level/tree-nested b/levels/it/low-level/tree-nested new file mode 100644 index 0000000..c7afce8 --- /dev/null +++ b/levels/it/low-level/tree-nested @@ -0,0 +1,38 @@ +[description] + +Trees can also point to other trees! This way, they can describe nested directory structures. + +When you add a file inside of a directory to the index, and then call `git write-tree`, it will create a nested tree for the directory, and attach the blob to it. + +To solve this level, build a little stick figure, as shown on the left - a tree that points to two blobs, as well to a tree that points to two blobs. + +[setup] + +[setup goal] + +echo "I'm the left arm" > arm1 +echo "I'm the right arm" > arm2 +mkdir hip +echo "I'm the left leg" > hip/leg1 +echo "I'm the right leg" > hip/leg2 +git add . +git write-tree + +[win] + +TREES=$(git cat-file --batch-check='%(objectname) %(objecttype)' --batch-all-objects | grep tree | cut -f1 -d" ") + +for OUTER_TREE in $TREES; do + NUMBER_OF_BLOB_CHILDREN=$(git cat-file -p $OUTER_TREE | cut -f2 -d" " | grep blob | wc -l) + NUMBER_OF_TREE_CHILDREN=$(git cat-file -p $OUTER_TREE | cut -f2 -d" " | grep tree | wc -l) + + if [ $NUMBER_OF_BLOB_CHILDREN -eq 2 -a $NUMBER_OF_TREE_CHILDREN -eq 1 ]; then + TREE_CHILD=$(git cat-file -p $OUTER_TREE | cut -f1 | grep tree | cut -d" " -f3) + NUMBER_OF_BLOB_CHILDREN_OF_TREE_CHILD=$(git cat-file -p $TREE_CHILD | cut -f2 -d" " | grep blob | wc -l) + if [ $NUMBER_OF_BLOB_CHILDREN_OF_TREE_CHILD -eq 2 ]; then + return 0 + fi + fi +done + +return 1 diff --git a/levels/it/low-level/tree-read b/levels/it/low-level/tree-read new file mode 100644 index 0000000..ba8c440 --- /dev/null +++ b/levels/it/low-level/tree-read @@ -0,0 +1,51 @@ +[description] + +As soon as you have some tree objects, you can always read them and set the index exactly to their content! Unsurprisingly, the command is called + + git read-tree + +For , you can provide the hash of any tree object - you can right-click one to insert its hash into the terminal! + +Try reading some of the trees in this repository into the index! + +[setup] + +EMPTY_TREE=$(git write-tree) + +echo "file 1" > file1 +echo "file 2" > file2 +git add . +git write-tree + +rm * +echo "file A" > fileA +echo "file B" > fileB +echo "file C" > fileC +git add . +TRIPLE_TREE=$(git write-tree) + +git read-tree "$EMPTY_TREE" + +[setup goal] + +EMPTY_TREE=$(git write-tree) + +echo "file 1" > file1 +echo "file 2" > file2 +git add . +git write-tree + +rm * +echo "file A" > fileA +echo "file B" > fileB +echo "file C" > fileC +git add . +TRIPLE_TREE=$(git write-tree) + +git read-tree "$EMPTY_TREE" + +git read-tree "$TRIPLE_TREE" + +[win] + +test "$(git ls-files | wc -l)" -gt 0 diff --git a/levels/it/low-level/welcome b/levels/it/low-level/welcome new file mode 100644 index 0000000..d669136 --- /dev/null +++ b/levels/it/low-level/welcome @@ -0,0 +1,33 @@ +[description] + +This is prototype #1 for the Git learning game by @bleeptrack and @blinry. Thanks for checking it out! <3 + +You can interact with the repository labelled "yours" by typing Bash commands in the terminal below! The visualization will show you its internal status. + +Let's get started by initializing an empty Git repository in the current directory by typing: + + git init + +[congrats] + +Well done! + +An empty Git repository is... well, quite empty. The only thing that always exists is a reference called "HEAD" - we'll learn what that is later! + +But first, let's look at some basics! + +(Click "Next Level" as soon as you're ready!) + +[setup] + +rm -rf .git + +[setup goal] + +rm -rf .git + +git init + +[win] + +test -d .git diff --git a/levels/it/merge/conflict b/levels/it/merge/conflict new file mode 100644 index 0000000..645b5ed --- /dev/null +++ b/levels/it/merge/conflict @@ -0,0 +1,47 @@ +title = Contraddizioni +cards = checkout commit-auto merge reset-hard + +[description] + +A volte le linee temporali si contraddicono a vicenda. + +Per esempio, in questo caso, un nostro cliente vuole che queste linee temporali siano unite ma hanno mangiato cose differenti in entrambe le linee temporali. + +Prova ad unirle! Noterai che c'è un conflitto! La macchina del tempo ti lascerà decidere come procedere: puoi modificare l'elemento problematico, ti verranno mostrate le parti che vanno in conflitto. Puoi mantenere una delle due versioni o creare una combinazione di entrambe! Poi rimuovi i marcatori >>>, <<<, e === e crea un nuovo commit per finalizare l'unione! + +La tua linea temporale definitiva è "main". + +[setup] + +echo "Si è appena svegliato. È affamato." > sam +git add . +git commit -m "L'inizio" + +git checkout -b pancakes +echo "Ha fatto colazione con pancakes ai mirtilli e sciroppo d'acero." > sam +git add . +git commit -m "Pancakes!" + +echo " +È al lavoro." >> sam +git commit -am "Va al lavoro" + +git checkout -b muesli main +echo "Ha fatto colazione con muesli all'avena e fragole." > sam +git add . +git commit -m "Muesli!" + +echo " +È al lavoro." >> sam +git commit -am "Va al lavoro" + +git checkout main + +[win] + +# Crea un compromesso tra le due colazioni nel branch "main". +git rev-parse main^ && test "$(git rev-parse main^1^^)" = "$(git rev-parse main^2^^)" + +[congrats] + +Yum, questa sembra una buona colazione! diff --git a/levels/it/merge/merge b/levels/it/merge/merge new file mode 100644 index 0000000..9050cb7 --- /dev/null +++ b/levels/it/merge/merge @@ -0,0 +1,82 @@ +title = Unire le linee temporali +cards = checkout commit-auto merge + +[description] + +Ecco un trucco per domire un pò più a lungo: svolgi tutte le tue attività mattutine in universi paralleli, e poi uniscile! + +[setup] + +echo "Non hai una baguette. + +Non hai caffe. + +Non hai una ciambella." > you + +git add . +git commit -m "L'inizio" + +echo "Hai una baguette. + +Non hai caffe. + +Non hai una ciambella." > you +git add . +git commit -m "Compri una baguette" + +echo "Mangi una baguette. + +Non hai caffe. + +Non hai una ciambella." > you +git add . +git commit -m "Mangi la baguette" + +git checkout HEAD~2 +echo "Non hai una baguette. + +Hai caffe. + +Non hai una ciambella." > you +git add . +git commit -m "Compri un pò di caffe" + +echo "Non hai una baguette. + +Bevi il caffe. + +Non hai una ciambella." > you +git add . +git commit -m "Bevi il caffe" + +git checkout HEAD~2 +echo "Non hai una baguette. + +Non hai caffe. + +Hai una ciambella." > you +git add . +git commit -m "Compri una ciambella" + +echo "Non hai una baguette. + +Non hai caffe. + +Mangi una ciambella." > you +git add . +git commit -m "Mangi la ciambella" + +git checkout --detach +git branch -D main + +[win] + +# Crea una situazione dove consumi una baguette, un caffe e una ciambella. +{ git show HEAD:you | grep "Mangi.*baguette"; } && { git show HEAD:you | grep "Bevi.*caffe"; } && { git show HEAD:you | grep "Mangi.*ciambella"; } + +# Crea (e spostati su) un commit di unione. +test "$(git log --pretty=%P -n 1 HEAD | wc -w)" -ge 2 + +[congrats] + +Mi chiedo se sei più rilassato quando *dormi* in linee temporali parallele... diff --git a/levels/it/merge/merge-abort b/levels/it/merge/merge-abort new file mode 100644 index 0000000..efabb5d --- /dev/null +++ b/levels/it/merge/merge-abort @@ -0,0 +1,54 @@ +title = Interrompere un merge +cards = checkout commit-auto merge merge-abort + +[description] + +Può capitare che tu voglia unire il contenuto di due commit ma si verifica un conflitto che al momento non vuoi risolvere. + +In queste situazioni, puoi interrompere il merge per riprendere successivamente. Usa + git merge --abort +mentre sei nel processo di merge. + +Prova a unire i due commit e interrompi la procedura di merge. + +[setup] + +echo "Un nuovo giorno sta iniziando" > you + +git add . +git commit -m "Start" + +echo "Stai camminando sulla corsia principale." >> you + +git add . +git commit -m "Corsia Principale" + + +git checkout HEAD~1 + +echo "Stai camminando sulla corsia laterale." >> you + +git add . +git commit -m "Corsia laterale" + +git checkout HEAD~1 + +git branch -D main + +[actions] + +if test -f .git/MERGE_HEAD; then + touch .git/secretfile +fi + +[win] + +# Hai provato a fare il merge? +test -f .git/secretfile + +# Hai interrotto il merge? +test -f .git/secretfile && ! test -f .git/MERGE_HEAD && ! git rev-parse HEAD^^ + +[congrats] + +Aaah, faremo il merge più tardi... diff --git a/levels/it/merge/sequence b/levels/it/merge/sequence new file mode 100644 index 0000000..2e1aa81 --- /dev/null +++ b/levels/it/merge/sequence @@ -0,0 +1,3 @@ +merge +conflict +merge-abort \ No newline at end of file diff --git a/levels/it/remotes/friend b/levels/it/remotes/friend new file mode 100644 index 0000000..c6f46c8 --- /dev/null +++ b/levels/it/remotes/friend @@ -0,0 +1,47 @@ +title = Amici +cards = pull push commit-auto checkout + +[description] + +Il tuo amico ha aggiunto un'altra linea alla tua tesi! Prendilo, aggiungine un'altra e reinvialo! + +Fate botta e risposta fino a che non ti ritrovi ad avere cinque linee! + +[setup yours] + +echo "Linea 1" > essay +git add . +git commit -m "Una linea" + +git push -u friend main + +[setup friend] + +git checkout main +echo "Linea 2, gnihihi" >> essay +git commit -am "Un'altra linea" + +[actions friend] + +if test "$(git log --oneline | wc -l)" -eq 3; then + git reset --hard main # Necessario perché la directory di lavoro non è aggiornata quando viene inviata all'amico + echo "Linea 4, blurbblubb" >> essay + git commit -am "Linea finale" + hint "Oh bene, Ho aggiunto la quarta linea!" +fi + +[win] + +# Ricevuto la seconda linea dal tuo amico. +git show HEAD:essay | grep gnihihi + +# Ricevuto la quarta linea dal tuo amico. +git show HEAD:essay | grep blurbblubb + +[win friend] + +# L'amico ha ricevuto la terza linea da te. +test "$(git show HEAD:essay | wc -l)" -ge 3 + +# L'amico ha ricevuto la quinta linea da te. +test "$(git show HEAD:essay | wc -l)" -ge 5 diff --git a/levels/it/remotes/problems b/levels/it/remotes/problems new file mode 100644 index 0000000..764a6fc --- /dev/null +++ b/levels/it/remotes/problems @@ -0,0 +1,33 @@ +title = Problemi +cards = checkout add pull push commit-auto merge + +[description] + +Entrambi, tu ed il tuo amico, avete lavorato sullo stesso file e volete sincronizare! + +[setup yours] + +echo "Il capannone delle bici dovrebbe essere ???" > file +git add . +git commit -m "inizio" + +git push -u friend main + +echo "Il capannone delle bici dovrebbe essere verde" > file + +[setup friend] + +git checkout main + +echo "Il capannone delle bici dovrebbe essere blu" > file +git commit -a -m "versione dell'amico" + +[win] + +# Fai il commit delle tue modifiche locali. +test "$(git status -s)" = "" + +[win friend] + +# Quarda il suggerimento dell'amico, trova un compromesso e rimandalo in dietro. +git rev-parse main^ && test "$(git rev-parse main^1^)" = "$(git rev-parse main^2^)" diff --git a/levels/it/remotes/sequence b/levels/it/remotes/sequence new file mode 100644 index 0000000..13c5715 --- /dev/null +++ b/levels/it/remotes/sequence @@ -0,0 +1,2 @@ +friend +problems diff --git a/levels/it/sandbox/empty b/levels/it/sandbox/empty new file mode 100644 index 0000000..1f954a5 --- /dev/null +++ b/levels/it/sandbox/empty @@ -0,0 +1,7 @@ +title = Empty sandbox + +[description] + +This is an empty sandbox you can play around in. + +[setup] diff --git a/levels/it/sandbox/remote b/levels/it/sandbox/remote new file mode 100644 index 0000000..f0ca2c0 --- /dev/null +++ b/levels/it/sandbox/remote @@ -0,0 +1,22 @@ +title = Sandbox with a remote +cards = checkout commit-auto pull fetch push + +[description] + +Here's a sandbox with a remote! Try pulling, fetching, or pushing! + +How can you push tags and branches on a remote? How can you delete them again? + +[setup yours] + +echo "Line 1" > essay +git add . +git commit -m "Initial commit" + +git push -u friend main + +[setup friend] + +git checkout main +echo "Line 2" >> essay +git commit -am "Another line" diff --git a/levels/it/sandbox/sequence b/levels/it/sandbox/sequence new file mode 100644 index 0000000..29aa91f --- /dev/null +++ b/levels/it/sandbox/sequence @@ -0,0 +1,3 @@ +empty +remote +three-commits diff --git a/levels/it/sandbox/three-commits b/levels/it/sandbox/three-commits new file mode 100644 index 0000000..3e5308c --- /dev/null +++ b/levels/it/sandbox/three-commits @@ -0,0 +1,26 @@ +title = Sandbox with three commits +cards = checkout add reset-file checkout-file commit merge rebase + +[setup] + +echo "You wake up." > you +git add . +git commit -m "The beginning" + +echo "You drink coffee." >> you +git commit -am "First things first" + +echo "You hear a knock on the door." >> you +git commit -am "Who's there?" + +git branch not_main + +[description] + +Here's a sandbox you can play around in. + +You can use both the playing cards, as well as the terminal. This is a real Git terminal! Fun things to try: + +- Make a commit that merges three timelines together at once! +- Create and delete some tags! +- Make a timeline that's completely independent of the rest! diff --git a/levels/it/sequence b/levels/it/sequence new file mode 100644 index 0000000..cefcd7a --- /dev/null +++ b/levels/it/sequence @@ -0,0 +1,13 @@ +intro +files +branches +merge +index +remotes +changing-the-past +shit-happens +workflows +bisect +stash +tags +sandbox diff --git a/levels/it/shit-happens/bad-commit b/levels/it/shit-happens/bad-commit new file mode 100644 index 0000000..0febbc2 --- /dev/null +++ b/levels/it/shit-happens/bad-commit @@ -0,0 +1,31 @@ +title = Annullare un cattivo commit +cards = reset commit-a + +[description] + +Oh no, abbiamo fatto un cattivo commit! Come possiamo annullare un commit e tornare ad un punto dove poter riprovare? + +La risposta è usare `git reset [commit]` che fa due cose: + +- Reimposta il riferimento (ref) del ramo corrente al commit che hai specificato. +- Reimposta l'indice a quel commit. + +Non cambia la tua directory di lavoro in nessun modo, il che significa che dopo puoi provare a rifare il commit che desideri. + + +[setup] + +echo "1 2 3 4" > numbers +git add . +git commit -m "commit iniziale" +echo "1 2 3 4 5 6 7 8 9 11" > numbers +git commit -am "Più numerrrrri" + +[win] + +# Nel primo commit il file numbers contiene i numeri da 1 a 10. +test "$(git show main:numbers)" = "1 2 3 4 5 6 7 8 9 10" +# Il messaggio di questo commit è "Più numeri". +git log -1 --oneline | grep "Più numeri" +# Il commit con l'errore si battitura non fa più parte del ramo principale. +git log --oneline | grep -v "rrrrr" diff --git a/levels/it/shit-happens/pushed-something-broken b/levels/it/shit-happens/pushed-something-broken new file mode 100644 index 0000000..cb7f2fb --- /dev/null +++ b/levels/it/shit-happens/pushed-something-broken @@ -0,0 +1,54 @@ +title = Ho fatto il push di qualcosa di rotto +cards = revert push + +[description] + +Stavamo parlando di come annulare un commit e correggerlo. Questo ci aiuta solo quando non lo abbiamo già inviato al server remoto. Quando questo succede e vuoi annullare completamente l'effetto del commit la tua migliore opzione è `git revert` + +[setup] + +echo "questo va bene + +? + +? + +?" > text +git add . +git commit -m bene +echo "questo va bene + +anche questo va bene + +? + +?" > text +git commit -am "anche questo bene" +echo "questo va bene + +anche questo va bene + +questo è veramente sbagliato + +?" > text +git commit -am "veramente sbagliato" +echo "questo va bene + +anche questo va bene + +questo è veramente sbagliato + +questo va nuovamente bene" > text +git commit -am "nuovamente bene" + +git push team main +git branch -u team/main main + +[setup team] + +[win team] + +# Il ramo main del Team non contiene più niente di sbagliato. +! { git show main:text | grep -q "veramente sbagliato"; } +# e la cronologia non è stata modificata. +git show main^:text | grep -q "veramente sbagliato" diff --git a/levels/it/shit-happens/reflog b/levels/it/shit-happens/reflog new file mode 100644 index 0000000..23f7bdc --- /dev/null +++ b/levels/it/shit-happens/reflog @@ -0,0 +1,26 @@ +title = Torna dove eri prima +cards = checkout reflog + +[description] + +Diciamo che stavi guardando qualcosa nel passato e poi sei tornato al ramo principale (main). + +Ma poi ti sei distratto e dopo la pausa pranzo, non riesci a ricordare cosa stavi facendo prima. Come puoi scoprirlo? + +C'è un comodo comando che ti mostra tutti i posti a cui la tua HEAD ha puntato in passato: + + git reflog + +[setup] + +for i in {1..10}; do + git commit --allow-empty -m $i + git branch $i +done +git checkout 3 +git checkout main + +[win] + +# Trova cosa stavi facendo prima e tornaci! +test "$(git rev-parse HEAD)" = "$(git rev-parse 3)" diff --git a/levels/it/shit-happens/restore-a-file b/levels/it/shit-happens/restore-a-file new file mode 100644 index 0000000..16cf0dc --- /dev/null +++ b/levels/it/shit-happens/restore-a-file @@ -0,0 +1,22 @@ +title = Recuperare un file cancellato +cards = checkout + +[description] + +Oops - Hai cancellato il file "essay" dove hai lavorato tutta la notte! + +Stai sereno, Git è qui per aiutare! Puoi usare `git checkout` per recuperare il file! + +[setup] + +echo importante > essay +git add . +git commit -m "Commit iniziale" +echo "contenuto importante" > essay +git commit -am "Ottimizzato essay" +rm essay + +[win] + +# Recupera il file "essay" che contiene "contenuto importante" +test "$(cat essay)" = "contenuto importante" diff --git a/levels/it/shit-happens/restore-a-file-from-the-past b/levels/it/shit-happens/restore-a-file-from-the-past new file mode 100644 index 0000000..c15f2a3 --- /dev/null +++ b/levels/it/shit-happens/restore-a-file-from-the-past @@ -0,0 +1,22 @@ +title = Recuperare un file dal passato +cards = checkout checkout-from commit + +[description] + +Questo è un problema simile: preferivi il file "essay" del primissimo commit e vuoi riaverlo indietro! Bene, checkout puo anche recuperare le cose dai vecchi commits. +Così: + + git checkout [commit] [file] + +[setup] + +echo "versione buona" > essay +git add . +git commit -m "commit iniziale" +echo "versione cattiva" > essay +git commit -am "\"Migliorato\" essay" + +[win] + +# Prendi la prima versione di "essay" e crea un nuovo commit con essa. +test "$(git show main:essay)" = "versione buona" diff --git a/levels/it/shit-happens/sequence b/levels/it/shit-happens/sequence new file mode 100644 index 0000000..663d5d9 --- /dev/null +++ b/levels/it/shit-happens/sequence @@ -0,0 +1,5 @@ +restore-a-file +restore-a-file-from-the-past +bad-commit +pushed-something-broken +reflog diff --git a/levels/it/stash/sequence b/levels/it/stash/sequence new file mode 100644 index 0000000..9dd02f7 --- /dev/null +++ b/levels/it/stash/sequence @@ -0,0 +1,5 @@ +stash +stash-pop +stash-clear +stash-branch +stash-merge diff --git a/levels/it/stash/stash b/levels/it/stash/stash new file mode 100644 index 0000000..6a4bc61 --- /dev/null +++ b/levels/it/stash/stash @@ -0,0 +1,45 @@ +title = Stashing +cards = checkout commit-auto merge reset-hard + +[description] + +You will encounter situations in which you are working on your project but you need to +put your current changes aside temporarily. To do so, you can use the stash function. Use + git stash push +to add your current changes to the stash stack. + +--- +tipp1 +--- +tipp2 +--- +tipp3 + +[setup] + +echo "Apple Pie:" > recipe + +git add . +git commit -m "creating a recipe" + +echo "- 4 Apples" >> recipe + +git add . +git commit -m "Adding ingredients" + +echo "- 500g Flour" >> recipe + +git checkout main + +[win] + +# Did you stash the current changes? +test "$(git stash list | wc -l)" -ge 1 + +[actions] + + + +[congrats] + +Nice stash you got there! :) diff --git a/levels/it/stash/stash-branch b/levels/it/stash/stash-branch new file mode 100644 index 0000000..e51e4d2 --- /dev/null +++ b/levels/it/stash/stash-branch @@ -0,0 +1,47 @@ +title = Ramo dalla scorta +cards = checkout commit-auto merge reset-hard + +[description] + +Se vuoi matenere tutte le modifiche ma non appartengono al ramo principale, puoi facilemnte creare un nuovo ramo dai cambiamenti dalle modifiche nascoste. Usando + git stash branch +Se vuoi solo usare l'ultimo elemento della scorta puoi lasciare vuota l'opzione . + +Crea un nuovo ramo dalle modifiche nascoste!! + +--- +tipp1 +--- +tipp2 +--- +tipp3 + +[setup] + +echo "Torta di mele:" > recipe + +git add . +git commit -m "creata una ricetta" + +echo "- 4 Mele" >> recipe + +git add . +git commit -m "Aggiunto ingredienti" + +echo "- 500g Farina" >> recipe +git stash push + +git checkout main + +[win] + +# Hai creato un nuovo ramo dai cambiamenti nascosti? +test "$(git branch --list| wc -l)" -ge 2 + +[actions] + + + +[congrats] + +I cambiamenti nascosti sono nel nuovo ramo! :) diff --git a/levels/it/stash/stash-clear b/levels/it/stash/stash-clear new file mode 100644 index 0000000..32f82cb --- /dev/null +++ b/levels/it/stash/stash-clear @@ -0,0 +1,57 @@ +title = Pulire la scorta +cards = checkout commit-auto merge reset-hard + +[description] + +Se vuoi controllare la tua scorta, usa il comando + git stash list + +Oh, non vuoi mantenere i tuoi cambiamenti nella scorta? C'è un modo per farlo? Poi vai avanti e pulisci la scorta con + git stash clear +Se vuoi solo scartare un certo elemento dalla scorta, puoi usare + git stash drop + +Pulisci la tua pila di scorta! + +--- +tipp1 +--- +tipp2 +--- +tipp3 + +[setup] + +echo "Torta di mele:" > recipe + +git add . +git commit -m "creata una ricetta" + +echo "- 4 Mele" >> recipe + +git add . +git commit -m "Aggiunto ingredienti" + +echo "- 500g Farina" >> recipe +git stash push + +echo "- 200g Zucchero" >> recipe +git stash push + +echo "- Pizzico di sale" >> recipe +git stash push + +git checkout main + +[win] + +# Hai pulito la tua pila di scorta? +test "$(git stash list | wc -l)" -eq 0 + +[actions] + + + +[congrats] + +Pulito tutto! :) diff --git a/levels/it/stash/stash-merge b/levels/it/stash/stash-merge new file mode 100644 index 0000000..a4ed759 --- /dev/null +++ b/levels/it/stash/stash-merge @@ -0,0 +1,53 @@ +title = Unire la scorta spuntata +cards = checkout commit-auto merge reset-hard + +[description] + +Quando vuoi riapplicare i cambiamenti ma hai continuato a lavora nei tuoi file, potresti ricevere un conflitto di unione! Facciamo un pò di pratica con questa situazione. +Fai uscire le modifiche dalla scorta con + git stash pop +e risolvi i conflitti di unione. Invia la soluzione dei cambiamenti e dopo pulisci la scorta. + +--- +tipp1 +--- +tipp2 +--- +tipp3 + +[setup] + +echo "Torta di mele:" > recipe + +git add . +git commit -m "creata una ricetta" + +echo "- 4 Mele" >> recipe + +git add . +git commit -m "Aggiunti ingredienti" + +echo "- 500g Farina" >> recipe + +git stash push + +echo "- Pizzico di sale" >> recipe + +git checkout main +git add recipe + +[win] + +# Hai rislto i conflitti ed inviato? +{ git show HEAD | grep "Farina"; } && { git show HEAD | grep "Sale"; } + +# Hai pulito la pila di scorta? +test "$(git stash list | wc -l)" -eq 0 + +[actions] + + + +[congrats] + +Yay, hai riavuto le tue modifiche in dietro! :) diff --git a/levels/it/stash/stash-pop b/levels/it/stash/stash-pop new file mode 100644 index 0000000..cffc30d --- /dev/null +++ b/levels/it/stash/stash-pop @@ -0,0 +1,46 @@ +title = Pop dalla scorta +cards = checkout commit-auto merge reset-hard + +[description] + +Quando hai nascosto le tue modifiche e vuoi riapplicarle nella tua directory di lavoro, puoi usare + git stash pop +Questo rimuoverà i cambiamenti dalla pila di scorta. Se voui anche mantenere le modifiche della pila di scorta usa + git stash apply + +--- +tipp1 +--- +tipp2 +--- +tipp3 + +[setup] + +echo "Torta di mele:" > recipe + +git add . +git commit -m "creata una ricetta" + +echo "- 4 Mele" >> recipe + +git add . +git commit -m "Aggiunto ingredienti" + +echo "- 500g Farina" >> recipe + +git stash push +git checkout main + +[win] + +# Hai pop i cambiamenti dalla pila di scorta? +test "$(git stash list | wc -l)" -eq 0 + +[actions] + + + +[congrats] + +Yay, hai riavuto i tuoi cambiamenti in dietro! :) diff --git a/levels/it/tags/add-tag b/levels/it/tags/add-tag new file mode 100644 index 0000000..2351635 --- /dev/null +++ b/levels/it/tags/add-tag @@ -0,0 +1,53 @@ +title = Creare etichette +cards = checkout commit-auto merge reset-hard + +[description] + +Alcuni dei tuoi commit potrebbero essere commit speciali. Potresti aver raggiunto un traguargo o un nuovo numero di versione. + +Puoi contrassegnare questo commit con un flag spegiale chiamato 'tag'. + +Scrivi + + git tag + +per etichettare il tuo commit. + +--- +tipp1 +--- +tipp2 +--- +tipp3 + +[setup] + +echo "event 1" > elenco-caratteristiche + +git add . +git commit -m "Aggiunta caratteristica 1" + +echo "event 2" >> elenco-caratteristiche + +git add . +git commit -m "Aggiunta caratteristica 2" + +echo "event 3" >> elenco-caratteristiche + +git add . +git commit -m "Aggiunta caratteristica 3" + +git checkout --detach main + +[win] + +# Hai creato un nuovo tag? +test "$(git tag -l | wc -l)" -ge 1 + +[actions] + + + +[congrats] + +Bene! Hai etichettato il tuo primo commit :) diff --git a/levels/it/tags/add-tag-later b/levels/it/tags/add-tag-later new file mode 100644 index 0000000..49e17d4 --- /dev/null +++ b/levels/it/tags/add-tag-later @@ -0,0 +1,50 @@ +title = Etichettare dopo +cards = checkout commit-auto merge reset-hard + +[description] + +Ma cosa succede se ti dimentichi di etichettare il corrente commit? +No c'è problema! Puoi etichettare i vecchi commit tramite + + git tag + +Etichetta il commit "Aggiunta caratteristica 2" con il nome "v1"! + +--- +tipp1 +--- +tipp2 +--- +tipp3 + +[setup] + +echo "event 1" > elenco-caratteristiche + +git add . +git commit -m "Aggiunta caratteristica 1" + +echo "event 2" >> elenco-caratteristiche + +git add . +git commit -m "Aggiunta caratteristica 2" + +echo "event 3" >> elecno-caratteristiche + +git add . +git commit -m "Aggiunta caratteristica 3" + +git checkout --detach main + +[win] + +# Hai creato una nuova etichetta? +test "$(git show v1 -s --format=%h)" = "$(git show HEAD~1 -s --format=%h)" + +[actions] + + + +[congrats] + +Motlo bene :) diff --git a/levels/it/tags/remote-tag b/levels/it/tags/remote-tag new file mode 100644 index 0000000..0a68035 --- /dev/null +++ b/levels/it/tags/remote-tag @@ -0,0 +1,58 @@ +title = Etichette remote +cards = pull push commit-auto checkout + +[description] + +Quando lavori con un repositor remoto, le etichette non sono messe o prese automaticamente. + +Puoi inviare un tag con + git push +O tutti i tags con + git push --tags + +Rimuovere i tags nel repository remoto con + git push --delete + +Puoi anche sincronizzare + git fetch --prune --prune-tags + + +Aggiungere un nome di tag "v2" nell'ultimo commit ed inviarlo nel remoto, anche prendere il tag "v1" in quello locale. +[setup yours] + +git checkout main + +git checkout main +echo "Condivisione dello spazzolino" > project-ideas +git add . +git commit -m "Prima idea" + +echo "Il mio telefono è sottosopra? App" >> project-ideas +git commit -am "Un'altra idea" + + + +git push friend main + +git branch -u friend/main main + +[setup friend] + + + +[actions friend] + +git tag v1 HEAD~1 + +[win] +# v1 tag nel tuo repo +test "$(git show v1 -s --format=%h)" = "$(git show HEAD~1 -s --format=%h)" + +# v2 tag nel tuo repo +test "$(git show v2 -s --format=%h)" = "$(git show HEAD -s --format=%h)" + + +[win friend] + +# v2 tag nel remoto +test "$(git show v2 -s --format=%h)" = "$(git show HEAD -s --format=%h)" diff --git a/levels/it/tags/remove-tag b/levels/it/tags/remove-tag new file mode 100644 index 0000000..2d2dfd9 --- /dev/null +++ b/levels/it/tags/remove-tag @@ -0,0 +1,53 @@ +title = Rimuovere etichette +cards = checkout commit-auto merge reset-hard + +[description] + +Hai aggiunto molte ectichette? Non c'è problema! Cancellali con + + git tag -d + +Rimuovi tutti i tag in questo repository! + +--- +tipp1 +--- +tipp2 +--- +tipp3 + +[setup] + +echo "event 1" > elenco-caratteristiche + +git add . +git commit -m "Aggiunta caratteristica 1" + +echo "event 2" >> elenco-caratteristiche + +git add . +git commit -m "Aggiunta caratteristica 2" + +echo "event 3" >> elenco-caratteristiche + +git add . +git commit -m "Aggiunta caratteristica 3" + +git tag v1 HEAD~2 +git tag v2 HEAD~1 +git tag v3 + +git checkout --detach main + +[win] + +# Hai riosso tutte le etichette? +test "$(git tag -l | wc -l)" -eq 0 + +[actions] + + + +[congrats] + +Molto bene :) diff --git a/levels/it/tags/sequence b/levels/it/tags/sequence new file mode 100644 index 0000000..fd63d9c --- /dev/null +++ b/levels/it/tags/sequence @@ -0,0 +1,4 @@ +add-tag +remove-tag +add-tag-later +remote-tag diff --git a/levels/it/unused/checkout b/levels/it/unused/checkout new file mode 100644 index 0000000..9d9c957 --- /dev/null +++ b/levels/it/unused/checkout @@ -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 diff --git a/levels/it/unused/clone b/levels/it/unused/clone new file mode 100644 index 0000000..8459c08 --- /dev/null +++ b/levels/it/unused/clone @@ -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 diff --git a/levels/it/unused/commit b/levels/it/unused/commit new file mode 100644 index 0000000..fd84cc9 --- /dev/null +++ b/levels/it/unused/commit @@ -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 diff --git a/levels/it/unused/commit-a b/levels/it/unused/commit-a new file mode 100644 index 0000000..747a009 --- /dev/null +++ b/levels/it/unused/commit-a @@ -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 diff --git a/levels/it/unused/fetch b/levels/it/unused/fetch new file mode 100644 index 0000000..377355a --- /dev/null +++ b/levels/it/unused/fetch @@ -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 diff --git a/levels/it/unused/files-move b/levels/it/unused/files-move new file mode 100644 index 0000000..8f65710 --- /dev/null +++ b/levels/it/unused/files-move @@ -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! diff --git a/levels/it/unused/index-mv b/levels/it/unused/index-mv new file mode 100644 index 0000000..9ff7270 --- /dev/null +++ b/levels/it/unused/index-mv @@ -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")" diff --git a/levels/it/unused/init b/levels/it/unused/init new file mode 100644 index 0000000..c76daa5 --- /dev/null +++ b/levels/it/unused/init @@ -0,0 +1,14 @@ +title = Welcome! +cards = init + +[description] + + +[setup] + +rm -rf .git + +[win] + +# Again, initialize your time machine! +test -d .git diff --git a/levels/it/unused/pull-push b/levels/it/unused/pull-push new file mode 100644 index 0000000..71ce61d --- /dev/null +++ b/levels/it/unused/pull-push @@ -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 " + +[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! :) diff --git a/levels/it/unused/remotes-add b/levels/it/unused/remotes-add new file mode 100644 index 0000000..db24b7d --- /dev/null +++ b/levels/it/unused/remotes-add @@ -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 diff --git a/levels/it/unused/remotes-delete b/levels/it/unused/remotes-delete new file mode 100644 index 0000000..c026204 --- /dev/null +++ b/levels/it/unused/remotes-delete @@ -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) diff --git a/levels/it/unused/restore b/levels/it/unused/restore new file mode 100644 index 0000000..1f9961e --- /dev/null +++ b/levels/it/unused/restore @@ -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") diff --git a/levels/it/unused/split b/levels/it/unused/split new file mode 100644 index 0000000..274b792 --- /dev/null +++ b/levels/it/unused/split @@ -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" diff --git a/levels/it/unused/steps b/levels/it/unused/steps new file mode 100644 index 0000000..cb84861 --- /dev/null +++ b/levels/it/unused/steps @@ -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" diff --git a/levels/it/unused/who-are-you b/levels/it/unused/who-are-you new file mode 100644 index 0000000..f06137c --- /dev/null +++ b/levels/it/unused/who-are-you @@ -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" diff --git a/levels/it/workflows/gitignore b/levels/it/workflows/gitignore new file mode 100644 index 0000000..dc55243 --- /dev/null +++ b/levels/it/workflows/gitignore @@ -0,0 +1,18 @@ +title = Ignoring files + +[description] + +That chicken is running around a lot, and changing often. We don't want to have it in our commits. + +Add it to the file .gitignore, and try using `git add .`! + +[setup] + +touch .gitignore +echo important > important +git add important +git commit -m "Initial commit" + +[actions] + +echo "$RANDOM" > chicken diff --git a/levels/it/workflows/pr b/levels/it/workflows/pr new file mode 100644 index 0000000..98fa95f --- /dev/null +++ b/levels/it/workflows/pr @@ -0,0 +1,25 @@ +title = Clonare un repo +cards = clone commit-auto reset-hard checkout file-new branch + +[description] + +Il tuo amico ha un problema! Clona il repo, crea una branch chiamata "solution" e aggiusta il problema in qulla branch. Quando sei pronto crea una "Pull Request" usando `git tag pr`. + +[setup] + +rm -rf .git + +[setup friend] + +echo "2 + 3 = " > file +git add . +git commit -m "Commit iniziale" + +[actions friend] + +git ls-remote yours | grep pr && git fetch yours && git merge yours/solution +git show main:file | grep 5 && hint "Grazie!" + +[win friend] + +git show main:file | grep 5 diff --git a/levels/it/workflows/sequence b/levels/it/workflows/sequence new file mode 100644 index 0000000..1be11a8 --- /dev/null +++ b/levels/it/workflows/sequence @@ -0,0 +1 @@ +pr diff --git a/locale/it_IT/it_IT-levels.po b/locale/it_IT/it_IT-levels.po deleted file mode 100644 index 0f5e4b4..0000000 --- a/locale/it_IT/it_IT-levels.po +++ /dev/null @@ -1,1186 +0,0 @@ -# Translations template for PROJECT. -# Copyright (C) 2022 ORGANIZATION -# This file is distributed under the same license as the PROJECT project. -# Automatically generated, 2022. -# -msgid "" -msgstr "" -"Project-Id-Version: PROJECT VERSION\n" -"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2022-08-18 10:39+0200\n" -"PO-Revision-Date: 2022-08-24 12:17+0200\n" -"Last-Translator: Luca Canali \n" -"Language-Team: none\n" -"Language: it\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" -"Generated-By: Babel 2.10.3\n" -"X-Generator: Poedit 3.1\n" - -#: TITLE -msgid "Living dangerously" -msgstr "Vivere pericolosamente" - -#: Command -msgid "Add another line to form.txt!" -msgstr "Aggiungi un'ulteriore linea a form.txt!" - -msgid "Making backups" -msgstr "Fare backups" - -msgid "Add another line to form2_really_final.txt!" -msgstr "Aggiungi un'ulteriore linea a form2_really_final.txt!" - -msgid "Enter the time machine" -msgstr "Entra nella macchina del tempo" - -msgid "Initialize the time machine!" -msgstr "Inizializza la macchina del tempo!" - -msgid "The command line" -msgstr "La linea di comando" - -msgid "Your first commit" -msgstr "Il tuo primo commit" - -msgid "Make a snapshot of the glass (a 'commit')" -msgstr "Crea un'istantanea di glass (un 'commit')" - -msgid "Change the contents of the glass!" -msgstr "Cambia il contenuto di glass!" - -msgid "And make a second commit!" -msgstr "E crea un secondo commit!" - -msgid "Working together" -msgstr "Lavoriamo assieme" - -msgid "Get the second commit from your teacher using `git pull`." -msgstr "Recupera il secondo commit dal tuo insegnante usando `git pull`." - -msgid "Add your name to the list of students" -msgstr "Aggiungi il tuo nome alla lista degli studenti" - -msgid "Commit your result." -msgstr "Conferma il risultato." - -msgid "And use `git push` to send it to your teacher!" -msgstr "E usa `git push` per inviarlo al tuo insegnante!" - -msgid "Unexpected Roommates" -msgstr "Coinquilini inaspettati" - -msgid "Remove all spider webs." -msgstr "Rimuovi tutte le ragnatele." - -msgid "But make sure you keep your bed!" -msgstr "Ma accertati di lasciare il tuo letto!" - -msgid "Interior design" -msgstr "Arredatore" - -msgid "Add two more pieces of furniture" -msgstr "Aggiungi altri due mobili" - -msgid "Make sure the colors match your bed's color." -msgstr "Assicurati che i colore corrisponda a quello del letto." - -msgid "Moving through time" -msgstr "Muoversi attraverso il tempo" - -msgid "Restore sisterly peace." -msgstr "Ripristina il salvadanaio della sorella." - -msgid "Make parallel commits" -msgstr "Crea commit paralleli" - -msgid "Make sure that the child is happy." -msgstr "Assicurati che il bambino sia felice." - -msgid "Make sure that the lion gets something to eat." -msgstr "Assicurati che il leone abbia qualcosa da mangiare." - -msgid "Creating branches" -msgstr "Creare branch" - -msgid "Create a branch called 'birthday' that points to the birthday timeline." -msgstr "" -"Creare una branch chiamata 'birthday' che punti alla timeline del compleanno." - -msgid "Create a branch called 'concert' that points to the concert timeline." -msgstr "" -"Crare una branch chiamata 'concert' che punti alla timeline del concerto." - -msgid "Branches grow with you!" -msgstr "Le branch crescono con te!" - -msgid "" -"Travel directly to the last yellow commit of the birthday timeline, make a " -"change to 'you', and make a commit" -msgstr "" -"VIaggia direttamente nell'ultimo commit della linea temporale del " -"compleanno, fai un cambiamento in 'you' e crea un commit" - -msgid "" -"Travel to the blue 'concert' branch, make a change to 'you', and a commit." -msgstr "" -"Viaggia nella branch blue 'concert', fai un cambiamento in 'you', e un " -"commit." - -msgid "Deleting branches" -msgstr "Cancella le branch" - -msgid "Find the bad branches and delete them. Keep only the best one." -msgstr "Trova le brach sbagliate e cancellale. Tieni solo la migliore." - -msgid "Moving branches around" -msgstr "Sposta le branch in giro" - -msgid "Did you eat a baguette on the baguette branch?" -msgstr "Hai mangiato una baguette nella branch 'baguette'?" - -msgid "Did you drink a coffee on the coffee branch?" -msgstr "Hai bevuto un caffe nella branch 'coffee'?" - -msgid "Did you eat a donut on the donut branch?" -msgstr "Hai mangiato una ciambella nella branch 'donut'?" - -msgid "Merging timelines" -msgstr "Unisci le line temporali" - -msgid "" -"Build a situation where you consumed a baguette, a coffee, *and* a donut." -msgstr "" -"Crea una condizione dove tu consumi una baguette, un caffe *e* una ciambella." - -msgid "Be on a merge commit." -msgstr "Crea (e spostati su) un commit di unione." - -msgid "Contradictions" -msgstr "Contradizioni" - -msgid "Make a breakfast compromise in the 'main' branch." -msgstr "Fai un compromesso per la colazione nella branch 'main'." - -msgid "Step by step" -msgstr "Passo dopo passo" - -msgid "Pick the timeline that's clearer, and make the alarm go off!" -msgstr "Scegli la linea temporale piu' chiara e fai suonare l'allarme!" - -msgid "Add new files to the index" -msgstr "Aggiungi nuovi file all'indice" - -msgid "Add the candle." -msgstr "Aggiungi la candela." - -msgid "Make a commit." -msgstr "Crea un commit." - -msgid "Update files in the index" -msgstr "Aggiorna i file nell'indice" - -msgid "Make a change to the candle." -msgstr "Fai un cambiamento nella candela." - -msgid "Resetting files in the index" -msgstr "Resetta i file nell'indice" - -msgid "Reset the changes in the green and blue candles!" -msgstr "Resetta i cambiamenti nelle candele verdi e blue!" - -msgid "And make a commit!" -msgstr "E crea un commit!" - -msgid "Adding changes step by step" -msgstr "Aggiungi i cambiamenti passo dopo passo" - -msgid "" -"Make changes to all three objects, to form a logical sequence of events!" -msgstr "" -"Crea cambiamenti in tutti e tre gli oggetti, da una sequenza logica di " -"eventi!" - -msgid "Only add one of these changes!" -msgstr "Aggiungi solo uno di questi cambiamenti!" - -msgid "And make a commit." -msgstr "E crea un commit." - -msgid "Make a second commit that only records a single change." -msgstr "Crea un secondo commit con solo i record con un singolo cambiamento." - -msgid "And a third one." -msgstr "E un terzo." - -msgid "Friend" -msgstr "Amici" - -msgid "Got the second line from your friend" -msgstr "Ottenuta la seconda linea dal tuo amico" - -msgid "Got the fourth line from your friend." -msgstr "Ottenuta la quarta linea dal tuo amico." - -msgid "The friend got a third line from you" -msgstr "Il tuo amico ti ha dato la terza linea" - -msgid "The friend got a fifth line from you" -msgstr "Il tuo amico ti ha dato la quinta linea" - -msgid "Problems" -msgstr "Problemi" - -msgid "Commit your local changes." -msgstr "Committa i tuoi combiamenti." - -msgid "Look at your friend's suggestion, make a compromise, and push it back." -msgstr "" -"Guarda i suggerimenti del tuo amico, fai un compromesso, e rimadalo in " -"dietro." - -msgid "Rebasing" -msgstr "" - -msgid "Order all tree branches into one and move the main branch ref" -msgstr "Ordina le tre branch in una e muovi il riferimeto alla branch 'main'" - -msgid "Reordering events" -msgstr "Riordinare gli eventi" - -msgid "Reorder the commits to dress yourself in the correct way" -msgstr "Riordina i commit per vestirti nell'ordine giusto" - -msgid "Restore a deleted file" -msgstr "Recupera un file cancellato" - -msgid "Restore the essay to contain 'important content'" -msgstr "" - -msgid "Restore a file from the past" -msgstr "" - -msgid "Get the first version of your essay, and make a new commit with it." -msgstr "" - -msgid "Undo a bad commit" -msgstr "" - -msgid "" -"In the last main commit, the numbers file contains the numbers from 1 to 10." -msgstr "" - -msgid "The commit message of that commit is 'More numbers'." -msgstr "" - -msgid "The commit with the typo is not part of the main branch anymore." -msgstr "" - -msgid "I pushed something broken" -msgstr "" - -msgid "The team's main branch no longer contains the bad thing." -msgstr "" - -msgid "And the history has not been modified." -msgstr "" - -msgid "Go back to where you were before" -msgstr "" - -msgid "Find out where you've been before, and go back there!" -msgstr "" - -msgid "Cloning a repo" -msgstr "" - -msgid "Yellow brick road" -msgstr "" - -msgid "Find the last good commit" -msgstr "" - -msgid "Stashing" -msgstr "" - -msgid "Did you stash the current changes?" -msgstr "" - -msgid "Pop from Stash" -msgstr "" - -msgid "Did you pop the changes from the stash stack?" -msgstr "" - -msgid "Clear the Stash" -msgstr "" - -msgid "Did you clear your stash stack?" -msgstr "" - -msgid "Branch from stash" -msgstr "" - -msgid "Did you create a new branch from the stashed changes?" -msgstr "" - -msgid "Merging popped stash" -msgstr "" - -msgid "Did you resolve the confict and commit?" -msgstr "" - -msgid "Did you clear stash stack?" -msgstr "" - -msgid "Creating tags" -msgstr "" - -msgid "Did you create a new tag?" -msgstr "" - -msgid "Removing tags" -msgstr "" - -msgid "Did you remove all tags?" -msgstr "" - -msgid "Tagging later" -msgstr "" - -msgid "Remote Tags" -msgstr "" - -msgid "v1 tag in your repo" -msgstr "" - -msgid "v2 tag in your repo" -msgstr "" - -msgid "v2 tag in the remote" -msgstr "" - -msgid "Empty sandbox" -msgstr "" - -msgid "Sandbox with a remote" -msgstr "" - -msgid "Sandbox with three commits" -msgstr "" - -#: DESCRIPTION -msgid "" -"So you have decided to apply for time travel school, to learn how to use " -"this time machine called 'Git'!\n" -"\n" -"How exciting!\n" -"\n" -"You're almost done with the paperwork! You just need to fill in one more " -"reason why you want to learn Git." -msgstr "" -"Bene hai deciso di fare domanda per la scuola di viaggio nel tempo, per " -"usare questa macchina del tempo chiamata 'Git'!\n" -"\n" -"Che emozione!\n" -"\n" -"Hai quasi concluso le scartoffie! Devi solamente inserire un motivo per il " -"quale vuoi imparare Git." - -msgid "" -"This time, you're making a lot of backup copies - you can look at them by " -"clicking on them!" -msgstr "" -"Questa volta hai fatto molti copie di backup - le puoi guardare cliccandoci " -"sopra!" - -msgid "" -"You've been accepted to time travel school! Yay! It's your first day! Your " -"teacher explains:\n" -"\n" -"'To do anything with a time machine, you first need to initialize it!'\n" -"\n" -"Drag that blue card up to play it!" -msgstr "" -"Sei stato accettato nella scuola della macchina del tempo! Yay! E' il tuo " -"primo giorno! Il tuo insegnante spiega;\n" -"\n" -"'Prima di fare qualsiasi altra cosa con la macchina del tempo, e' necessario " -"che la inizializzi!'\n" -"\n" -"Trascina verso l'alto la carta blue per usarla!" - -msgid "" -"These playing cards are designed to be easy to use and to remember! We'd " -"suggest sticking to them if you don't have a lot of experience with Git!" -msgstr "" -"Queste carte da gioco sono state disegnate per essere facili da utilizzare e " -"ricordare! Ti consigliamo di usarle se non hai molta esperienza con Git!" - -msgid "" -"You can use your time machine to make snapshots of objects around you! Here, " -"let's practice this!\n" -"\n" -"(Your teacher pours some water into a glass.)" -msgstr "" -"Puoi usare la tua macchina del tempo per creare delle istantanee degli " -"oggetti che ti circondano! Ecco, facciamo questo!\n" -"\n" -"(Il tuo insegnante versa dell'acqua nel bicchiere.)" - -msgid "" -"Let's add your name to our list of students!\n" -"\n" -"I already have a second commit of it in my time machine - let's work " -"together!" -msgstr "" -"Aggiungiamo il tuo nome nella nostra lista di studenti!\n" -"\n" -"Io ne ho gia' un secondo commit nella mia macchina del tempo - lavoriamo " -"assieme!" - -msgid "" -"The first day at Time Travel School comes to an end and you receive the key " -"to your room.\n" -"Full of excitement you open the door just to find... spider webs! Spider " -"webs everywhere!\n" -"\n" -"Remove all the spider webs you can find with the remove card!" -msgstr "" -"Il primo giorno nella scuola del viaggio nel tempo! La scuola finisce e " -"rivevi le chiavi della tua stanza.\n" -"Pieno di eccitazione apri la porta per trovare ... ragnatele! Ragnatele " -"ovunque!\n" -"\n" -"Elimina tutte le ragnatele che trovi con la carta cancella!" - -msgid "" -"Now that your room looks tidy, you can start to unpack your stuff. You " -"brought two new pieces of furniture with you and with a bright smile,\n" -"you see that their colors match the color of your bed!\n" -"\n" -"Build up your two pieces of furniture by playing the touch card.\n" -"Then name your furniture - you can choose whatever you like.\n" -"\n" -"Make sure the colors match! You can find the bed's color in its " -"description.\n" -"Don't forget to add a color and description to your new furnitures, too!" -msgstr "" -"Adesso che la tua camera è riordinata, puoi iniziare a disfare le valige. Ti " -"sei portato due nuovi mobili con te e con un felicità,\n" -"noti che il loro colore si abbina al letto!\n" -"\n" -"Monta i tuoi due mobili giocando la carta touch.\n" -"Quindi dai un nome ai tuoi mobili - puoi scegliere quello che preferisci.\n" -"\n" -"Accertati che il colori corrispondano! Puoi trovare il colore del letto " -"nella sua descrizione.\n" -"Non ti dimenticare anche di aggiungere il colore e la descrizione ai tuoi " -"nuovi mobili!" - -msgid "" -"The yellow boxes are frozen points in time, we call them 'commits'! You can " -"travel between them using the 'checkout' card! (Try it!)\n" -"\n" -"Can you find out what happened here? Then, while on the last commit, edit " -"the files to fix the problem, and make a new commit!" -msgstr "" -"La scatole gialle sono un punto fisso nel tempo, possiamo chiamarli " -"\"commits\"! Puoi viaggiare tra loro usando la carta \"checkout\"! " -"(Provala!)\n" -"\n" -"Puoi scoprire cosa è successo qui? Quindi, durante ultimo commit, modifica i " -"files per risolvere il problema ed invia un nuovo commit!" - -msgid "" -"Did you know that creating parallel timelines is perfectly legal and safe? " -"It's true!\n" -"\n" -"Can you find out when things went wrong in this zoo? Then, go back to the " -"last good commit and create a parallel universe where everyone is happy!" -msgstr "" -"Sai che creare linee temporali parallele è perfettamente legale e sicuro? E' " -"vero!\n" -"\n" -"Puoi trovare cosa c'è di sbagliato in questo zoo? Bene, torna indietro " -"all'ultimo commit buono e creane un universo parallelo dove tutti sono " -"felici!" - -msgid "" -"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!\n" -"\n" -"To make it easier to tell which timeline is which, you can create time " -"portals! (We call these 'branches'.)" -msgstr "" -"Sei stato invitato a due feste! In una di queste, suona la tua band " -"preferita - e l'altra e' il compleanno del tuo migliore amico. Dove dovresti " -"andare? Non ti preoccupare - sei un agente del tempo in addestramento, tu " -"puoi andare ad entrambe le feste!\n" -"\n" -"Per rendere piu' facile capire quale sequenza temporale e', puoi creare dei " -"portali! ( Che chiamiamo 'branches'.)" - -msgid "" -"Note that there are two options to 'travel to the end of a timeline':\n" -"\n" -"First, you can directly travel to the commit, like we've done it before.\n" -"\n" -"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!" -msgstr "" - -msgid "" -"Life is full of dangers, right? Even when walking to school, it seems like " -"there's a lot of risks!\n" -"\n" -"This Monday is especially bad. You made it to school, but there's some " -"timelines you definitely don't want to keep around." -msgstr "" - -msgid "" -"One of your colleagues messed up here, and put the branches in the wrong " -"timelines!\n" -"\n" -"You could delete and re-create these branches - but you can also directly " -"move them to different commits, by using\n" -"\n" -" git checkout\n" -"\n" -"on the branch names, and then using\n" -"\n" -" git reset --hard\n" -"\n" -"on the commit where you want the branch to be.\n" -"\n" -"The donut branch is in the right place, but the timeline is still incomplete " -"- make you actually *eat* the donut in that branch!" -msgstr "" - -msgid "" -"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!" -msgstr "" - -msgid "" -"Sometimes, timelines will contradict each other.\n" -"\n" -"For example, in this case, one of our clients wants these timelines merged, " -"but they ate different things for breakfast in both timelines.\n" -"\n" -"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!\n" -"\n" -"Let your finalized timeline be the 'main' one." -msgstr "" - -msgid "" -"Welcome to today's lesson! We're going to learn how to make commits with " -"more precision!\n" -"\n" -"Have a look at these two timelines. They have exactly the same outcome. But " -"one of them makes it much easier to figure out what happened." -msgstr "" - -msgid "" -"So far, when we made a commit, we've always recorded the current status of " -"all objects, right?\n" -"\n" -"But Git allows you to pick which changes you want to put in a commit!\n" -"\n" -"To learn how that works, we need to learn about the 'index'! In the index, " -"we can prepare what will be in the next commit. In this game, the index is " -"represented by a blue aura around icons in the file browser!\n" -"\n" -"Initially, the index is empty. To make a commit that contains a new file, we " -"need to add it!" -msgstr "" - -msgid "" -"When we change files, the index won't change on its own. We have to use `git " -"add` to update the index to the changed version of the file.\n" -"\n" -"Let's try that!\n" -"\n" -"The icons in the file browser show you when the actual file (white) and the " -"version in the index (blue) are different, and when they are the same!" -msgstr "" - -msgid "" -"See the dark shadow behind the icons? That's the version of the file in the " -"last commit!\n" -"\n" -"For example, these candles have been blown out, and that change has been " -"added.\n" -"\n" -"But you decide that this was a mistake! You only want to blow out the red " -"candle in the next commit!\n" -"\n" -"If you already have updated the index to a changed file, but want to reset " -"it, you can use `git reset`!" -msgstr "" - -msgid "" -"The index is really useful, because it allows us to be precise about which " -"changes we want to include in each commit!" -msgstr "" - -msgid "" -"Your friend added another line to your essay! Get it, add a third one and " -"send it to them!\n" -"\n" -"Take turns until you have five lines!" -msgstr "" - -msgid "" -"Both you and your friend have been working on the file, and want to sync up!" -msgstr "" - -msgid "" -"Okay - turns out that saving time in the morning by utilizing parallel " -"universes is against the regulations of the International Time Travel " -"Association. You'll have to do your tasks in sequence after all.\n" -"\n" -"See the 'rebase' card? When you drag it to a commit, it will copy the events " -"in your current timeline after the specified one! This way, make a clean, " -"linear timeline where you visit all three shops.\n" -"\n" -"Again, we want to make that our base reality - the 'main' branch should " -"point to that timeline!" -msgstr "" - -msgid "" -"Oops, looks like there's something messed up here. Can you put the events " -"back into their correct order?\n" -"\n" -"There are two ways to do this: You can drag the 'interactive rebase' card to " -"the commit before the one you want to change, then reorder the lines in the " -"file that opens, and save it.\n" -"\n" -"Or you can reset the main tag to the very first commit, and then cherry-pick " -"single commits in the order you want. You have cards for both approaches!" -msgstr "" - -msgid "" -"Oops - you deleted the 'essay' file, which you worked on all night!\n" -"\n" -"Luckily, Git is here to help! You can use `git checkout` to restore the file!" -msgstr "" - -msgid "" -"Here's a similar problem: you really liked the essay from the very first " -"commit, and want to have it back! Well, checkout can also restore things " -"from older commits, Here's how:\n" -"\n" -" git checkout [commit] [file]" -msgstr "" - -msgid "" -"Oh no, we made a bad commit! How can we undo making the commit, and go back " -"to a point where we can try again?\n" -"\n" -"The answer is using `git reset [commit]`, which does two things:\n" -"\n" -"- It resets the current branch ref to the commit you specify.\n" -"- And it resets the index to that commit.\n" -"\n" -"It does not change your working directory in any way, which means that after " -"that, you can try making the commit you want again." -msgstr "" - -msgid "" -"We were talking about how to undo a commit, and fix it. This only helps when " -"you haven't already pushed it to a remote. When that has happened, and you " -"want to undo the effects of the commit completely, your best option is `git " -"revert`" -msgstr "" - -msgid "" -"Say you were looking at something in the past, and then switched back to the " -"main branch.\n" -"\n" -"But then, you got reaaally distracted, and after your lunch break, you can't " -"remember on which commit in the past you were before. How can you find out?\n" -"\n" -"There's a convenient command that shows you all the places your HEAD did " -"point to in the past:\n" -"\n" -" git reflog" -msgstr "" - -msgid "" -"Your friend has a problem! Clone the repo, create a branch called " -"'solution', and fix the problem in this branch. When you're ready, make a " -"'Pull Request' by using `git tag pr`." -msgstr "" - -msgid "" -"(Please zoom out a bit using your mouse wheel! :D)\n" -"\n" -"Oh no! You have lost your key at some point during the day!\n" -"\n" -"Sure, you could look at every single commit in an attempt to find it - but " -"there's a better way: your time machine has a built-in way to find the point " -"in time where things went wrong quickly!\n" -"\n" -"First, play the 'bisect start' card. Then, go to a commit where you don't " -"have the key, and play the 'bisect bad' card. Likewise, go to a commit early " -"on where you have the key *in your pocket*, and play the 'bisect good " -"card'.\n" -"\n" -"After you've found the last good commit, reset the main branch to it. What " -"happened to the key after you lost it?" -msgstr "" - -msgid "" -"You will encounter situations in which you are working on your project but " -"you need to\n" -"put your current changes aside temporarily. To do so, you can use the stash " -"function. Use\n" -" git stash push \n" -"to add your current changes to the stash stack.\n" -"\n" -"---\n" -"tipp1\n" -"---\n" -"tipp2\n" -"---\n" -"tipp3" -msgstr "" - -msgid "" -"When you stashed your changes and you want to apply them back to your " -"current working directory, you can use\n" -" git stash pop\n" -"This will remove the changes from the stash stack. If you also want to keep " -"the changes on the stash stack, use\n" -" git stash apply\n" -"\n" -"---\n" -"tipp1\n" -"---\n" -"tipp2\n" -"---\n" -"tipp3" -msgstr "" - -msgid "" -"If you want to inspect your stash stack, use the command\n" -" git stash list\n" -" \n" -"Oh, you don't want to keep your stashed changes? There are way too many? " -"Then go ahead and clear the stack with\n" -" git stash clear\n" -"If you only want to discard a certain stash entry, you can use\n" -" git stash drop \n" -" \n" -"Clear your stash stack!\n" -"\n" -"---\n" -"tipp1\n" -"---\n" -"tipp2\n" -"---\n" -"tipp3" -msgstr "" - -msgid "" -"If you want to keep your changes but they don't belong to the main branch, " -"you can easily\n" -"create a new branch from your stashed changes. Just use\n" -" git stash branch \n" -"If you just want to use the latest stash entry, you can leave the " -"option empty.\n" -"\n" -"Create a new branch from the stashed changes!\n" -"\n" -"---\n" -"tipp1\n" -"---\n" -"tipp2\n" -"---\n" -"tipp3" -msgstr "" - -msgid "" -"When you want to reapply your changes but you already continued working on " -"your file, you might get\n" -"a merge conflict! Let's practise this situation.\n" -"Pop the changes from the stash with\n" -" git stash pop\n" -"and resolve the merge conflict. Commit the resolved changes and clear the " -"stash stack afterwards.\n" -"\n" -"---\n" -"tipp1\n" -"---\n" -"tipp2\n" -"---\n" -"tipp3" -msgstr "" - -msgid "" -"Some of your commits may be special commits. Maybe you reached a milestone " -"or a new version number.\n" -"\n" -"You can mark these commits with a special flag called 'tag'.\n" -"\n" -"Write \n" -"\n" -" git tag \n" -" \n" -"to tag your commit.\n" -"\n" -"---\n" -"tipp1\n" -"---\n" -"tipp2\n" -"---\n" -"tipp3" -msgstr "" - -msgid "" -"You added way too many tags? No prob! Delete them with\n" -"\n" -" git tag -d \n" -" \n" -"Remove all tags in this repo!\n" -"\n" -"---\n" -"tipp1\n" -"---\n" -"tipp2\n" -"---\n" -"tipp3" -msgstr "" - -msgid "" -"But what happens if you forgot to tag your current commit?\n" -"No Prob! You can also tag older commits via\n" -"\n" -" git tag \n" -" \n" -"Tag the commit 'Adding feature 2' with the name 'v1'!\n" -"\n" -"---\n" -"tipp1\n" -"---\n" -"tipp2\n" -"---\n" -"tipp3" -msgstr "" - -msgid "" -"When you work with remote repositories, tags are not pushed or pulled " -"automatically.\n" -"\n" -"You can push a tag with\n" -" git push \n" -"Or all tags with:\n" -" git push --tags\n" -" \n" -"Deleting tags on your remote works with: \n" -" git push --delete \n" -" \n" -"You can also sync \n" -" git fetch --prune --prune-tags\n" -"\n" -"\n" -"Add a tag named 'v2' to the last commit and push it to the remote. Also pull " -"the v1 tag to your local repository." -msgstr "" - -msgid "This is an empty sandbox you can play around in." -msgstr "" - -msgid "" -"Here's a sandbox with a remote! Try pulling, fetching, or pushing!\n" -"\n" -"How can you push tags and branches on a remote? How can you delete them " -"again?" -msgstr "" - -msgid "" -"Here's a sandbox you can play around in.\n" -"\n" -"You can use both the playing cards, as well as the terminal. This is a real " -"Git terminal! Fun things to try:\n" -"\n" -"- Make a commit that merges three timelines together at once!\n" -"- Create and delete some tags!\n" -"- Make a timeline that's completely independent of the rest!" -msgstr "" - -#: HITS -msgid "" -"But there's another way to interact with Git:\n" -"\n" -"Try typing `git init` into the black terminal below, and pressing the enter " -"key!" -msgstr "" -"Ma c'e' un'altro modo per interagire con Git:\n" -"\n" -"Prova a scrivere `git init` nel terminale sotto, per poi premere il tasto " -"invio!" - -msgid "" -"Again, instead of using the card, you can also type the commands which are " -"printed on it into the black terminal below!\n" -"\n" -"This is totally optional! But this will be a super useful skill in the real " -"world - and it will give you a sparkling golden badge! :)" -msgstr "" -"Nuovamente, al posto di usare la carta, puoi anche digitare, nel terminale " -"sotto, i comandi che trovi stampato sulla carta!\n" -"\n" -"Questo e' completamente opzionale! Ma questa sara' una skill veramente utile " -"nel mondo reale - e ti dara' un distintivo scintillante! :)" - -msgid "" -"To go back to old commands, you can press arrow up and down. That way, you " -"don't have to type in long commands twice." -msgstr "" -"Per scorrere i vecchi comandi, puoi premere la freccia su e giu. In questo " -"modo, non dovrai digitare nuovamente i comandi." - -msgid "" -"On the command line, you can easily delete all files ending in -web using " -"this command:\n" -"\n" -" rm *web" -msgstr "" -"Nella riga di comando, puoi facilmente cancellare tutti i file -web usando " -"questo comando:\n" -"\n" -" rm *web" - -msgid "" -"To checkout a specific commit, type `git checkout`, then a space, and then " -"right click on the commit you want!\n" -"\n" -"This will insert the commit's unique identifier!" -msgstr "" -"Guarda uno specifico commit, digita `git checkout` uno spazio e premi il " -"tasto destro sopra il commit che vuoi!\n" -"\n" -"Questo inserirà l'identificatore unico del commit!" - -msgid "" -"The blue animal represents a concept known as the 'HEAD pointer' in Git: It " -"shows you which commit is the current one.\n" -"\n" -"Here's a cool trick to go to the previous commit: \n" -"\n" -" git checkout HEAD^\n" -"\n" -"You can also go back two commits by typing, for example: \n" -"\n" -" git checkout HEAD~2" -msgstr "" -"L'animale blue rappresenta un concetto conosciuto come \"HEAD pointer\" in " -"Git: Ti mostra qual'è il commit attuale.\n" -"\n" -"Ecco un simpatico trucchetto andare al commit precedente:\n" -"\n" -" git checkout HEAD^\n" -"\n" -"Puoi anche andare indietro di 2 commit digitando, pre esempio:\n" -"\n" -" git checkout HEAD~2" - -msgid "" -"Branches also make it really easy to travel between different places using " -"the command line! As soon as you have a branch called 'birthday', you can " -"type `git checkout birthday` to travel to it!" -msgstr "" -"Le branch rendono molto facile viaggiare tra luoghi diversi anche usando la " -"linea di comando! Quando hai una branch chiamata 'birthday', puoi digitare " -"`git checkout bithday` per raggiungerlo!" - -msgid "" -"To travel to a branch, type `git checkout name_of_the_branch`.\n" -"\n" -"And to travel to the last commit, type `git checkout --detach " -"name_of_the_branch`." -msgstr "" -"Per viaggiare in una branch, digita `git checkout nome_della_branch`.\n" -"\n" -"Per andare all'ultimo commit, digita `git checkout --detach " -"nome_della_branch`." - -msgid "" -"You can use tab completion in the terminal! Start typing a filename, then " -"press the tab key to complete its name. This will often save you some time!" -msgstr "" -"Puoi usare la tab completition nel terminale! Inizia a digitare il nome del " -"file, quindi permi il tasto tab per completare il suo nome. Questo ti " -"permettera' di risparmiare tempo!" - -#: CONGRAT -msgid "" -"Good job, you solved the level!\n" -"\n" -"Feel free to try a few more things or click 'Next level'." -msgstr "" -"Ottimo lavoro, hai risolto il livello!\n" -" Sentiti libero di provare qualche altra cosa o clicca su 'Prossimo livello'." - -msgid "" -"Suddenly, your cat jumps on the table, snatches away the form, and runs " -"away! Oh no. All your hard work, gone!\n" -"\n" -"You clearly need a better solution.\n" -"\n" -"(Click 'Next Level' as soon as you're ready!)" -msgstr "" -"All'improvviso il tuo gatto salta sul tavolo, strappa via il modulo e scappa " -"via!Oh no. Tutto il tuo duro lavoro, andato!\n" -"\n" -"Devi trovare una buona soluzione\n" -"\n" -"(Clicca 'Prossimo livello' appena sei pronto!)" - -msgid "" -"Okay, this kind of works.\n" -"\n" -"But you're a bit worried that you'll end up with hundreds of copies of this " -"form, and it will be hard to keep track of all of them.\n" -"\n" -"And especially when working with other people, sending copies back and forth " -"doesn't seem ideal.\n" -"\n" -"You can't wait to try these time machines!" -msgstr "" -"Ok, questo cosa può funzionare.\n" -"\n" -"Ma sei un pochino preoccupato che alla fine ti troverai con un centinaio di " -"copie di questo form, ed e' difficile tenerne traccia di tutto loro.\n" -"\n" -"Specialmente quando lavorerai con altre persone, inviare copie avanti ed " -"indietro non sembra l'ideale.\n" -"\n" -"Non vedi l'ora di provare questa macchina del tempo!" - -msgid "" -"Nice! See that little owl squirrel that appeared? It will be your companion, " -"and always show you where you are in time!" -msgstr "" -"Bene! Vedi quel piccolo animale che e' apparso? Sara' il tuo compagno e ti " -"mostrera' dove ti trovi nel tempo!" - -msgid "" -"Cool! Instead of using the playing cards, you can also do everything via the " -"command line!\n" -"\n" -"The command line is pretty powerful! Often, you can use it to solve tasks " -"faster compared to using a graphical interface." -msgstr "" -"Bello! Al posto di usare le carte, puoi anche fare tutto tramite la linea di " -"comando!\n" -"\n" -"La linea di comando e' molto potente! A volte, puoi usarla per svolgere " -"alcuni compiti piu' velocemente in confronto all'uso dell'interfaccia " -"grafica." - -msgid "" -"Nice! You can try making some additional commits. When you feel comfortable, " -"click on 'Next Level'." -msgstr "" -"Bene! Puoi provare a creare altri commit aggiuntivi. Quando ti senti a tuo " -"agio, clicca su 'Prossimo livello'." - -msgid "" -"Welcome to time travel school! :) I'll see you for your first class tomorrow!" -msgstr "" -"Benvenuto nella scuola del viaggio nel tempo! :) Ci vediamo domani per la " -"tua prima lezione!" - -msgid "Your room looks now very tidy and cozy! Time to unpack your stuff!" -msgstr "" -"Adesso la tua camera è ordinata ed accogliente! E' ora di disfare le valige!" - -msgid "Don't you immediately feel more at home?" -msgstr "Non ti senti subito a casa?" - -msgid "" -"Wonderful! Now that you're getting familiar with the time machine, let's " -"look at some more complicated situations..." -msgstr "" -"Stupendo! Adesso hai più famigliarità con la macchina del tempo, vediamo " -"situazioni più complicate..." - -msgid "" -"Whew, good job! This seems like a *much* better outcome.\n" -"\n" -"Feel free to add more parallel timelines, or make them longer.\n" -"\n" -"If you're ready, our next mission is already waiting..." -msgstr "" -"Whew, ottimo lavoro! Questo sembra un risultato molto migliore.\n" -"\n" -"Sentiti libero di aggiungere altre line temporali parallele o allungarle.\n" -"\n" -"Se sei pronto, la prossima missione ci sta aspettando..." - -msgid "" -"Now you can travel between those branches easily (using `git checkout`) - " -"try it!\n" -"\n" -"Your friend is happy that you made it to the birthday party and you also got " -"your concert ticket signed. Yay!" -msgstr "" - -msgid "" -"On second thought, maybe you even prefer the ice cream timeline to the main " -"one? :)" -msgstr "" - -msgid "" -"I wonder if you're more relaxed when you *sleep* in parallel timelines..." -msgstr "" - -msgid "Yum, that sounds like a good breakfast!" -msgstr "" - -msgid "" -"Notice how the other timelines and commits are still there - if anything " -"goes wrong, you can also travel back to them.\n" -"\n" -"It's really hard to actually *destroy* stuff with your time machine." -msgstr "" - -msgid "" -"Feel free to reset the level and try the other strategy! Which one do you " -"like better?" -msgstr "" - -msgid "" -"Well done! :) The only problem is that you now have to walk all the way back " -"home, again..." -msgstr "" - -msgid "Nice stash you got there! :)" -msgstr "" - -msgid "Yay, you got your changes back! :)" -msgstr "" - -msgid "All clear! :)" -msgstr "Tutto chiaro! :)" - -msgid "Stashed changes are in a new branch! :)" -msgstr "" - -msgid "Nice! You tagged your first commit :)" -msgstr "Bello! Hai taggato il tuo primo commit :)" - -msgid "Well done :)" -msgstr "Ben fatto :)" diff --git a/locale/levels.pot b/locale/levels.pot deleted file mode 100644 index eeced88..0000000 --- a/locale/levels.pot +++ /dev/null @@ -1,1037 +0,0 @@ -# Translations template for PROJECT. -# Copyright (C) 2022 ORGANIZATION -# This file is distributed under the same license as the PROJECT project. -# Automatically generated, 2022. -# -msgid "" -msgstr "" -"Project-Id-Version: PROJECT VERSION\n" -"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2022-08-18 10:39+0200\n" -"PO-Revision-Date: 2022-08-19 16:53+0200\n" -"Last-Translator: Automatically generated\n" -"Language-Team: none\n" -"Language: it\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" -"Generated-By: Babel 2.10.3\n" -"X-Generator: Poedit 3.1\n" - -#: TITLE -msgid "Living dangerously" -msgstr "" - -#: Command -msgid "Add another line to form.txt!" -msgstr "" - -msgid "Making backups" -msgstr "" - -msgid "Add another line to form2_really_final.txt!" -msgstr "" - -msgid "Enter the time machine" -msgstr "" - -msgid "Initialize the time machine!" -msgstr "" - -msgid "The command line" -msgstr "" - -msgid "Your first commit" -msgstr "" - -msgid "Make a snapshot of the glass (a 'commit')" -msgstr "" - -msgid "Change the contents of the glass!" -msgstr "" - -msgid "And make a second commit!" -msgstr "" - -msgid "Working together" -msgstr "" - -msgid "Get the second commit from your teacher using `git pull`." -msgstr "" - -msgid "Add your name to the list of students" -msgstr "" - -msgid "Commit your result." -msgstr "" - -msgid "And use `git push` to send it to your teacher!" -msgstr "" - -msgid "Unexpected Roommates" -msgstr "" - -msgid "Remove all spider webs." -msgstr "" - -msgid "But make sure you keep your bed!" -msgstr "" - -msgid "Interior design" -msgstr "" - -msgid "Add two more pieces of furniture" -msgstr "" - -msgid "Make sure the colors match your bed's color." -msgstr "" - -msgid "Moving through time" -msgstr "" - -msgid "Restore sisterly peace." -msgstr "" - -msgid "Make parallel commits" -msgstr "" - -msgid "Make sure that the child is happy." -msgstr "" - -msgid "Make sure that the lion gets something to eat." -msgstr "" - -msgid "Creating branches" -msgstr "" - -msgid "Create a branch called 'birthday' that points to the birthday timeline." -msgstr "" - -msgid "Create a branch called 'concert' that points to the concert timeline." -msgstr "" - -msgid "Branches grow with you!" -msgstr "" - -msgid "" -"Travel directly to the last yellow commit of the birthday timeline, make a " -"change to 'you', and make a commit" -msgstr "" - -msgid "" -"Travel to the blue 'concert' branch, make a change to 'you', and a commit." -msgstr "" - -msgid "Deleting branches" -msgstr "" - -msgid "Find the bad branches and delete them. Keep only the best one." -msgstr "" - -msgid "Moving branches around" -msgstr "" - -msgid "Did you eat a baguette on the baguette branch?" -msgstr "" - -msgid "Did you drink a coffee on the coffee branch?" -msgstr "" - -msgid "Did you eat a donut on the donut branch?" -msgstr "" - -msgid "Merging timelines" -msgstr "" - -msgid "" -"Build a situation where you consumed a baguette, a coffee, *and* a donut." -msgstr "" - -msgid "Be on a merge commit." -msgstr "" - -msgid "Contradictions" -msgstr "" - -msgid "Make a breakfast compromise in the 'main' branch." -msgstr "" - -msgid "Step by step" -msgstr "" - -msgid "Pick the timeline that's clearer, and make the alarm go off!" -msgstr "" - -msgid "Add new files to the index" -msgstr "" - -msgid "Add the candle." -msgstr "" - -msgid "Make a commit." -msgstr "" - -msgid "Update files in the index" -msgstr "" - -msgid "Make a change to the candle." -msgstr "" - -msgid "Resetting files in the index" -msgstr "" - -msgid "Reset the changes in the green and blue candles!" -msgstr "" - -msgid "And make a commit!" -msgstr "" - -msgid "Adding changes step by step" -msgstr "" - -msgid "" -"Make changes to all three objects, to form a logical sequence of events!" -msgstr "" - -msgid "Only add one of these changes!" -msgstr "" - -msgid "And make a commit." -msgstr "" - -msgid "Make a second commit that only records a single change." -msgstr "" - -msgid "And a third one." -msgstr "" - -msgid "Friend" -msgstr "" - -msgid "Got the second line from your friend" -msgstr "" - -msgid "Got the fourth line from your friend." -msgstr "" - -msgid "The friend got a third line from you" -msgstr "" - -msgid "The friend got a fifth line from you" -msgstr "" - -msgid "Problems" -msgstr "" - -msgid "Commit your local changes." -msgstr "" - -msgid "Look at your friend's suggestion, make a compromise, and push it back." -msgstr "" - -msgid "Rebasing" -msgstr "" - -msgid "Order all tree branches into one and move the main branch ref" -msgstr "" - -msgid "Reordering events" -msgstr "" - -msgid "Reorder the commits to dress yourself in the correct way" -msgstr "" - -msgid "Restore a deleted file" -msgstr "" - -msgid "Restore the essay to contain 'important content'" -msgstr "" - -msgid "Restore a file from the past" -msgstr "" - -msgid "Get the first version of your essay, and make a new commit with it." -msgstr "" - -msgid "Undo a bad commit" -msgstr "" - -msgid "" -"In the last main commit, the numbers file contains the numbers from 1 to 10." -msgstr "" - -msgid "The commit message of that commit is 'More numbers'." -msgstr "" - -msgid "The commit with the typo is not part of the main branch anymore." -msgstr "" - -msgid "I pushed something broken" -msgstr "" - -msgid "The team's main branch no longer contains the bad thing." -msgstr "" - -msgid "And the history has not been modified." -msgstr "" - -msgid "Go back to where you were before" -msgstr "" - -msgid "Find out where you've been before, and go back there!" -msgstr "" - -msgid "Cloning a repo" -msgstr "" - -msgid "Yellow brick road" -msgstr "" - -msgid "Find the last good commit" -msgstr "" - -msgid "Stashing" -msgstr "" - -msgid "Did you stash the current changes?" -msgstr "" - -msgid "Pop from Stash" -msgstr "" - -msgid "Did you pop the changes from the stash stack?" -msgstr "" - -msgid "Clear the Stash" -msgstr "" - -msgid "Did you clear your stash stack?" -msgstr "" - -msgid "Branch from stash" -msgstr "" - -msgid "Did you create a new branch from the stashed changes?" -msgstr "" - -msgid "Merging popped stash" -msgstr "" - -msgid "Did you resolve the confict and commit?" -msgstr "" - -msgid "Did you clear stash stack?" -msgstr "" - -msgid "Creating tags" -msgstr "" - -msgid "Did you create a new tag?" -msgstr "" - -msgid "Removing tags" -msgstr "" - -msgid "Did you remove all tags?" -msgstr "" - -msgid "Tagging later" -msgstr "" - -msgid "Remote Tags" -msgstr "" - -msgid "v1 tag in your repo" -msgstr "" - -msgid "v2 tag in your repo" -msgstr "" - -msgid "v2 tag in the remote" -msgstr "" - -msgid "Empty sandbox" -msgstr "" - -msgid "Sandbox with a remote" -msgstr "" - -msgid "Sandbox with three commits" -msgstr "" - -#: DESCRIPTION -msgid "" -"So you have decided to apply for time travel school, to learn how to use " -"this time machine called 'Git'!\n" -"\n" -"How exciting!\n" -"\n" -"You're almost done with the paperwork! You just need to fill in one more " -"reason why you want to learn Git." -msgstr "" - -msgid "" -"This time, you're making a lot of backup copies - you can look at them by " -"clicking on them!" -msgstr "" - -msgid "" -"You've been accepted to time travel school! Yay! It's your first day! Your " -"teacher explains:\n" -"\n" -"'To do anything with a time machine, you first need to initialize it!'\n" -"\n" -"Drag that blue card up to play it!" -msgstr "" - -msgid "" -"These playing cards are designed to be easy to use and to remember! We'd " -"suggest sticking to them if you don't have a lot of experience with Git!" -msgstr "" - -msgid "" -"You can use your time machine to make snapshots of objects around you! Here, " -"let's practice this!\n" -"\n" -"(Your teacher pours some water into a glass.)" -msgstr "" - -msgid "" -"Let's add your name to our list of students!\n" -"\n" -"I already have a second commit of it in my time machine - let's work " -"together!" -msgstr "" - -msgid "" -"The first day at Time Travel School comes to an end and you receive the key " -"to your room.\n" -"Full of excitement you open the door just to find... spider webs! Spider " -"webs everywhere!\n" -"\n" -"Remove all the spider webs you can find with the remove card!" -msgstr "" - -msgid "" -"Now that your room looks tidy, you can start to unpack your stuff. You " -"brought two new pieces of furniture with you and with a bright smile,\n" -"you see that their colors match the color of your bed!\n" -"\n" -"Build up your two pieces of furniture by playing the touch card.\n" -"Then name your furniture - you can choose whatever you like.\n" -"\n" -"Make sure the colors match! You can find the bed's color in its " -"description.\n" -"Don't forget to add a color and description to your new furnitures, too!" -msgstr "" - -msgid "" -"The yellow boxes are frozen points in time, we call them 'commits'! You can " -"travel between them using the 'checkout' card! (Try it!)\n" -"\n" -"Can you find out what happened here? Then, while on the last commit, edit " -"the files to fix the problem, and make a new commit!" -msgstr "" - -msgid "" -"Did you know that creating parallel timelines is perfectly legal and safe? " -"It's true!\n" -"\n" -"Can you find out when things went wrong in this zoo? Then, go back to the " -"last good commit and create a parallel universe where everyone is happy!" -msgstr "" - -msgid "" -"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!\n" -"\n" -"To make it easier to tell which timeline is which, you can create time " -"portals! (We call these 'branches'.)" -msgstr "" - -msgid "" -"Note that there are two options to 'travel to the end of a timeline':\n" -"\n" -"First, you can directly travel to the commit, like we've done it before.\n" -"\n" -"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!" -msgstr "" - -msgid "" -"Life is full of dangers, right? Even when walking to school, it seems like " -"there's a lot of risks!\n" -"\n" -"This Monday is especially bad. You made it to school, but there's some " -"timelines you definitely don't want to keep around." -msgstr "" - -msgid "" -"One of your colleagues messed up here, and put the branches in the wrong " -"timelines!\n" -"\n" -"You could delete and re-create these branches - but you can also directly " -"move them to different commits, by using\n" -"\n" -" git checkout\n" -"\n" -"on the branch names, and then using\n" -"\n" -" git reset --hard\n" -"\n" -"on the commit where you want the branch to be.\n" -"\n" -"The donut branch is in the right place, but the timeline is still incomplete " -"- make you actually *eat* the donut in that branch!" -msgstr "" - -msgid "" -"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!" -msgstr "" - -msgid "" -"Sometimes, timelines will contradict each other.\n" -"\n" -"For example, in this case, one of our clients wants these timelines merged, " -"but they ate different things for breakfast in both timelines.\n" -"\n" -"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!\n" -"\n" -"Let your finalized timeline be the 'main' one." -msgstr "" - -msgid "" -"Welcome to today's lesson! We're going to learn how to make commits with " -"more precision!\n" -"\n" -"Have a look at these two timelines. They have exactly the same outcome. But " -"one of them makes it much easier to figure out what happened." -msgstr "" - -msgid "" -"So far, when we made a commit, we've always recorded the current status of " -"all objects, right?\n" -"\n" -"But Git allows you to pick which changes you want to put in a commit!\n" -"\n" -"To learn how that works, we need to learn about the 'index'! In the index, " -"we can prepare what will be in the next commit. In this game, the index is " -"represented by a blue aura around icons in the file browser!\n" -"\n" -"Initially, the index is empty. To make a commit that contains a new file, we " -"need to add it!" -msgstr "" - -msgid "" -"When we change files, the index won't change on its own. We have to use `git " -"add` to update the index to the changed version of the file.\n" -"\n" -"Let's try that!\n" -"\n" -"The icons in the file browser show you when the actual file (white) and the " -"version in the index (blue) are different, and when they are the same!" -msgstr "" - -msgid "" -"See the dark shadow behind the icons? That's the version of the file in the " -"last commit!\n" -"\n" -"For example, these candles have been blown out, and that change has been " -"added.\n" -"\n" -"But you decide that this was a mistake! You only want to blow out the red " -"candle in the next commit!\n" -"\n" -"If you already have updated the index to a changed file, but want to reset " -"it, you can use `git reset`!" -msgstr "" - -msgid "" -"The index is really useful, because it allows us to be precise about which " -"changes we want to include in each commit!" -msgstr "" - -msgid "" -"Your friend added another line to your essay! Get it, add a third one and " -"send it to them!\n" -"\n" -"Take turns until you have five lines!" -msgstr "" - -msgid "" -"Both you and your friend have been working on the file, and want to sync up!" -msgstr "" - -msgid "" -"Okay - turns out that saving time in the morning by utilizing parallel " -"universes is against the regulations of the International Time Travel " -"Association. You'll have to do your tasks in sequence after all.\n" -"\n" -"See the 'rebase' card? When you drag it to a commit, it will copy the events " -"in your current timeline after the specified one! This way, make a clean, " -"linear timeline where you visit all three shops.\n" -"\n" -"Again, we want to make that our base reality - the 'main' branch should " -"point to that timeline!" -msgstr "" - -msgid "" -"Oops, looks like there's something messed up here. Can you put the events " -"back into their correct order?\n" -"\n" -"There are two ways to do this: You can drag the 'interactive rebase' card to " -"the commit before the one you want to change, then reorder the lines in the " -"file that opens, and save it.\n" -"\n" -"Or you can reset the main tag to the very first commit, and then cherry-pick " -"single commits in the order you want. You have cards for both approaches!" -msgstr "" - -msgid "" -"Oops - you deleted the 'essay' file, which you worked on all night!\n" -"\n" -"Luckily, Git is here to help! You can use `git checkout` to restore the file!" -msgstr "" - -msgid "" -"Here's a similar problem: you really liked the essay from the very first " -"commit, and want to have it back! Well, checkout can also restore things " -"from older commits, Here's how:\n" -"\n" -" git checkout [commit] [file]" -msgstr "" - -msgid "" -"Oh no, we made a bad commit! How can we undo making the commit, and go back " -"to a point where we can try again?\n" -"\n" -"The answer is using `git reset [commit]`, which does two things:\n" -"\n" -"- It resets the current branch ref to the commit you specify.\n" -"- And it resets the index to that commit.\n" -"\n" -"It does not change your working directory in any way, which means that after " -"that, you can try making the commit you want again." -msgstr "" - -msgid "" -"We were talking about how to undo a commit, and fix it. This only helps when " -"you haven't already pushed it to a remote. When that has happened, and you " -"want to undo the effects of the commit completely, your best option is `git " -"revert`" -msgstr "" - -msgid "" -"Say you were looking at something in the past, and then switched back to the " -"main branch.\n" -"\n" -"But then, you got reaaally distracted, and after your lunch break, you can't " -"remember on which commit in the past you were before. How can you find out?\n" -"\n" -"There's a convenient command that shows you all the places your HEAD did " -"point to in the past:\n" -"\n" -" git reflog" -msgstr "" - -msgid "" -"Your friend has a problem! Clone the repo, create a branch called " -"'solution', and fix the problem in this branch. When you're ready, make a " -"'Pull Request' by using `git tag pr`." -msgstr "" - -msgid "" -"(Please zoom out a bit using your mouse wheel! :D)\n" -"\n" -"Oh no! You have lost your key at some point during the day!\n" -"\n" -"Sure, you could look at every single commit in an attempt to find it - but " -"there's a better way: your time machine has a built-in way to find the point " -"in time where things went wrong quickly!\n" -"\n" -"First, play the 'bisect start' card. Then, go to a commit where you don't " -"have the key, and play the 'bisect bad' card. Likewise, go to a commit early " -"on where you have the key *in your pocket*, and play the 'bisect good " -"card'.\n" -"\n" -"After you've found the last good commit, reset the main branch to it. What " -"happened to the key after you lost it?" -msgstr "" - -msgid "" -"You will encounter situations in which you are working on your project but " -"you need to\n" -"put your current changes aside temporarily. To do so, you can use the stash " -"function. Use\n" -" git stash push \n" -"to add your current changes to the stash stack.\n" -"\n" -"---\n" -"tipp1\n" -"---\n" -"tipp2\n" -"---\n" -"tipp3" -msgstr "" - -msgid "" -"When you stashed your changes and you want to apply them back to your " -"current working directory, you can use\n" -" git stash pop\n" -"This will remove the changes from the stash stack. If you also want to keep " -"the changes on the stash stack, use\n" -" git stash apply\n" -"\n" -"---\n" -"tipp1\n" -"---\n" -"tipp2\n" -"---\n" -"tipp3" -msgstr "" - -msgid "" -"If you want to inspect your stash stack, use the command\n" -" git stash list\n" -" \n" -"Oh, you don't want to keep your stashed changes? There are way too many? " -"Then go ahead and clear the stack with\n" -" git stash clear\n" -"If you only want to discard a certain stash entry, you can use\n" -" git stash drop \n" -" \n" -"Clear your stash stack!\n" -"\n" -"---\n" -"tipp1\n" -"---\n" -"tipp2\n" -"---\n" -"tipp3" -msgstr "" - -msgid "" -"If you want to keep your changes but they don't belong to the main branch, " -"you can easily\n" -"create a new branch from your stashed changes. Just use\n" -" git stash branch \n" -"If you just want to use the latest stash entry, you can leave the " -"option empty.\n" -"\n" -"Create a new branch from the stashed changes!\n" -"\n" -"---\n" -"tipp1\n" -"---\n" -"tipp2\n" -"---\n" -"tipp3" -msgstr "" - -msgid "" -"When you want to reapply your changes but you already continued working on " -"your file, you might get\n" -"a merge conflict! Let's practise this situation.\n" -"Pop the changes from the stash with\n" -" git stash pop\n" -"and resolve the merge conflict. Commit the resolved changes and clear the " -"stash stack afterwards.\n" -"\n" -"---\n" -"tipp1\n" -"---\n" -"tipp2\n" -"---\n" -"tipp3" -msgstr "" - -msgid "" -"Some of your commits may be special commits. Maybe you reached a milestone " -"or a new version number.\n" -"\n" -"You can mark these commits with a special flag called 'tag'.\n" -"\n" -"Write \n" -"\n" -" git tag \n" -" \n" -"to tag your commit.\n" -"\n" -"---\n" -"tipp1\n" -"---\n" -"tipp2\n" -"---\n" -"tipp3" -msgstr "" - -msgid "" -"You added way too many tags? No prob! Delete them with\n" -"\n" -" git tag -d \n" -" \n" -"Remove all tags in this repo!\n" -"\n" -"---\n" -"tipp1\n" -"---\n" -"tipp2\n" -"---\n" -"tipp3" -msgstr "" - -msgid "" -"But what happens if you forgot to tag your current commit?\n" -"No Prob! You can also tag older commits via\n" -"\n" -" git tag \n" -" \n" -"Tag the commit 'Adding feature 2' with the name 'v1'!\n" -"\n" -"---\n" -"tipp1\n" -"---\n" -"tipp2\n" -"---\n" -"tipp3" -msgstr "" - -msgid "" -"When you work with remote repositories, tags are not pushed or pulled " -"automatically.\n" -"\n" -"You can push a tag with\n" -" git push \n" -"Or all tags with:\n" -" git push --tags\n" -" \n" -"Deleting tags on your remote works with: \n" -" git push --delete \n" -" \n" -"You can also sync \n" -" git fetch --prune --prune-tags\n" -"\n" -"\n" -"Add a tag named 'v2' to the last commit and push it to the remote. Also pull " -"the v1 tag to your local repository." -msgstr "" - -msgid "This is an empty sandbox you can play around in." -msgstr "" - -msgid "" -"Here's a sandbox with a remote! Try pulling, fetching, or pushing!\n" -"\n" -"How can you push tags and branches on a remote? How can you delete them " -"again?" -msgstr "" - -msgid "" -"Here's a sandbox you can play around in.\n" -"\n" -"You can use both the playing cards, as well as the terminal. This is a real " -"Git terminal! Fun things to try:\n" -"\n" -"- Make a commit that merges three timelines together at once!\n" -"- Create and delete some tags!\n" -"- Make a timeline that's completely independent of the rest!" -msgstr "" - -#: HITS -msgid "" -"But there's another way to interact with Git:\n" -"\n" -"Try typing `git init` into the black terminal below, and pressing the enter " -"key!" -msgstr "" - -msgid "" -"Again, instead of using the card, you can also type the commands which are " -"printed on it into the black terminal below!\n" -"\n" -"This is totally optional! But this will be a super useful skill in the real " -"world - and it will give you a sparkling golden badge! :)" -msgstr "" - -msgid "" -"To go back to old commands, you can press arrow up and down. That way, you " -"don't have to type in long commands twice." -msgstr "" - -msgid "" -"On the command line, you can easily delete all files ending in -web using " -"this command:\n" -"\n" -" rm *web" -msgstr "" - -msgid "" -"To checkout a specific commit, type `git checkout`, then a space, and then " -"right click on the commit you want!\n" -"\n" -"This will insert the commit's unique identifier!" -msgstr "" - -msgid "" -"The blue animal represents a concept known as the 'HEAD pointer' in Git: It " -"shows you which commit is the current one.\n" -"\n" -"Here's a cool trick to go to the previous commit: \n" -"\n" -" git checkout HEAD^\n" -"\n" -"You can also go back two commits by typing, for example: \n" -"\n" -" git checkout HEAD~2" -msgstr "" - -msgid "" -"Branches also make it really easy to travel between different places using " -"the command line! As soon as you have a branch called 'birthday', you can " -"type `git checkout birthday` to travel to it!" -msgstr "" - -msgid "" -"To travel to a branch, type `git checkout name_of_the_branch`.\n" -"\n" -"And to travel to the last commit, type `git checkout --detach " -"name_of_the_branch`." -msgstr "" - -msgid "" -"You can use tab completion in the terminal! Start typing a filename, then " -"press the tab key to complete its name. This will often save you some time!" -msgstr "" - -#: CONGRAT -msgid "" -"Good job, you solved the level!\n" -"\n" -"Feel free to try a few more things or click 'Next level'." -msgstr "" - -msgid "" -"Suddenly, your cat jumps on the table, snatches away the form, and runs " -"away! Oh no. All your hard work, gone!\n" -"\n" -"You clearly need a better solution.\n" -"\n" -"(Click 'Next Level' as soon as you're ready!)" -msgstr "" - -msgid "" -"Okay, this kind of works.\n" -"\n" -"But you're a bit worried that you'll end up with hundreds of copies of this " -"form, and it will be hard to keep track of all of them.\n" -"\n" -"And especially when working with other people, sending copies back and forth " -"doesn't seem ideal.\n" -"\n" -"You can't wait to try these time machines!" -msgstr "" - -msgid "" -"Nice! See that little owl squirrel that appeared? It will be your companion, " -"and always show you where you are in time!" -msgstr "" - -msgid "" -"Cool! Instead of using the playing cards, you can also do everything via the " -"command line!\n" -"\n" -"The command line is pretty powerful! Often, you can use it to solve tasks " -"faster compared to using a graphical interface." -msgstr "" - -msgid "" -"Nice! You can try making some additional commits. When you feel comfortable, " -"click on 'Next Level'." -msgstr "" - -msgid "" -"Welcome to time travel school! :) I'll see you for your first class tomorrow!" -msgstr "" - -msgid "Your room looks now very tidy and cozy! Time to unpack your stuff!" -msgstr "" - -msgid "Don't you immediately feel more at home?" -msgstr "" - -msgid "" -"Wonderful! Now that you're getting familiar with the time machine, let's " -"look at some more complicated situations..." -msgstr "" - -msgid "" -"Whew, good job! This seems like a *much* better outcome.\n" -"\n" -"Feel free to add more parallel timelines, or make them longer.\n" -"\n" -"If you're ready, our next mission is already waiting..." -msgstr "" - -msgid "" -"Now you can travel between those branches easily (using `git checkout`) - " -"try it!\n" -"\n" -"Your friend is happy that you made it to the birthday party and you also got " -"your concert ticket signed. Yay!" -msgstr "" - -msgid "" -"On second thought, maybe you even prefer the ice cream timeline to the main " -"one? :)" -msgstr "" - -msgid "" -"I wonder if you're more relaxed when you *sleep* in parallel timelines..." -msgstr "" - -msgid "Yum, that sounds like a good breakfast!" -msgstr "" - -msgid "" -"Notice how the other timelines and commits are still there - if anything " -"goes wrong, you can also travel back to them.\n" -"\n" -"It's really hard to actually *destroy* stuff with your time machine." -msgstr "" - -msgid "" -"Feel free to reset the level and try the other strategy! Which one do you " -"like better?" -msgstr "" - -msgid "" -"Well done! :) The only problem is that you now have to walk all the way back " -"home, again..." -msgstr "" - -msgid "Nice stash you got there! :)" -msgstr "" - -msgid "Yay, you got your changes back! :)" -msgstr "" - -msgid "All clear! :)" -msgstr "" - -msgid "Stashed changes are in a new branch! :)" -msgstr "" - -msgid "Nice! You tagged your first commit :)" -msgstr "" - -msgid "Well done :)" -msgstr "" diff --git a/scenes/Language.gd b/scenes/Language.gd index 35d96b3..7c0ec82 100644 --- a/scenes/Language.gd +++ b/scenes/Language.gd @@ -29,6 +29,7 @@ func _on_item_pressed(id): var value = tr(game.languages[key]) if value == lang: game.os_lang = key + game.levels_dir = "res://levels/" + key check_current_items() TranslationServer.set_locale(game.os_lang) diff --git a/scenes/chapter.gd b/scenes/chapter.gd index 9f2abc2..856f59b 100644 --- a/scenes/chapter.gd +++ b/scenes/chapter.gd @@ -13,7 +13,7 @@ func load(path): var level_names = [] var dir = Directory.new() - dir.open("res://levels/%s" % slug) + dir.open(game.levels_dir + "/%s" % slug) dir.list_dir_begin() while true: @@ -28,7 +28,7 @@ func load(path): var final_level_sequence = [] - var level_sequence = Array(helpers.read_file("res://levels/%s/sequence" % slug, "").split("\n")) + var level_sequence = Array(helpers.read_file(game.levels_dir + "/%s/sequence" % slug, "").split("\n")) for level in level_sequence: if level == "": @@ -42,7 +42,7 @@ func load(path): for l in final_level_sequence: var level = Level.new() - level.load("res://levels/%s/%s" % [slug, l]) + level.load(game.levels_dir + "/%s/%s" % [slug, l]) levels.push_back(level) func _to_string(): diff --git a/scenes/game.gd b/scenes/game.gd index a336900..cf84db2 100644 --- a/scenes/game.gd +++ b/scenes/game.gd @@ -1,7 +1,8 @@ extends Node var languages = {"en": tr("English"), "it": tr("Italian")} # Localizations allowed -var os_lang = OS.get_locale_language() # Variable for game localization +var os_lang = OS.get_locale_language() # Variable for game localization (it, en, ecc...) +var levels_dir = "res://levels/" + os_lang var tmp_prefix = OS.get_user_data_dir() + "/tmp/" var global_shell diff --git a/scenes/level.gd b/scenes/level.gd index 743430f..bb9ba30 100644 --- a/scenes/level.gd +++ b/scenes/level.gd @@ -20,9 +20,8 @@ func load(path): # This is a new-style level. var config = helpers.parse(path) - title = tr(config.get("title", slug)) # Title of Levels + title = config.get("title", slug) description = config.get("description", "(no description)") - description = tr(description.replace("\"", "\'")) # Descriptions how to make the level # Surround all lines indented with four spaces with [code] tags. var monospace_regex = RegEx.new() @@ -31,11 +30,9 @@ func load(path): description = description.split("---") var cli_hints = config.get("cli", "") - cli_hints = tr(cli_hints.replace("\"", "\'")) # suggestions to work strong # Also do this substitution in the CLI hints. cli_hints = monospace_regex.sub(cli_hints, "\n [code][color=#bbbb5d]$1[/color][/code]", true) - # Also replace `code` with [code] tags. var monospace_inline_regex = RegEx.new() monospace_inline_regex.compile("`([^`]+)`") @@ -46,8 +43,6 @@ func load(path): description[0] = description[0] + "\n\n[color=#787878]"+cli_hints+"[/color]" congrats = config.get("congrats", "Good job, you solved the level!\n\nFeel free to try a few more things or click 'Next level'.") - congrats = congrats.replace("\"", "\'") - congrats = tr(congrats) # Congratulations when the level is finish cards = Array(config.get("cards", "").split(" ")) if cards == [""]: cards = [] @@ -87,7 +82,6 @@ func load(path): for line in Array(config[k].split("\n")): if line.length() > 0 and line[0] == "#": desc = line.substr(1).strip_edges(true, true) - desc = desc.replace("\"", "\'") else: if not repos[repo].win_conditions.has(desc): repos[repo].win_conditions[desc] = "" diff --git a/scenes/levels.gd b/scenes/levels.gd index 0efb4dd..518e9fd 100644 --- a/scenes/levels.gd +++ b/scenes/levels.gd @@ -3,13 +3,14 @@ extends Node var chapters func _ready(): + print(game.os_lang) reload() func reload(): chapters = [] var dir = Directory.new() - dir.open("res://levels/") + dir.open(game.levels_dir) dir.list_dir_begin() var chapter_names = [] @@ -26,7 +27,7 @@ func reload(): var final_chapter_sequence = [] - var chapter_sequence = Array(helpers.read_file("res://levels/sequence", "").split("\n")) + var chapter_sequence = Array(helpers.read_file(game.levels_dir + "/sequence", "").split("\n")) for chapter in chapter_sequence: if chapter == "": @@ -40,5 +41,5 @@ func reload(): for c in final_chapter_sequence: var chapter = Chapter.new() - chapter.load("res://levels/%s" % c) + chapter.load(game.levels_dir + "/%s" % c) chapters.push_back(chapter)