From ab323659af602beb54fb49f73e28919d6548cb5d Mon Sep 17 00:00:00 2001 From: mht Date: Sun, 23 Mar 2014 16:29:53 +0800 Subject: [PATCH] update fetch.js and remoteBranches.js --- src/levels/remote/fetch.js | 79 ++++++++++++++++++++++++++++- src/levels/remote/remoteBranches.js | 63 +++++++++++++++++++++++ 2 files changed, 140 insertions(+), 2 deletions(-) diff --git a/src/levels/remote/fetch.js b/src/levels/remote/fetch.js index c5b0e4a1..65787ab5 100644 --- a/src/levels/remote/fetch.js +++ b/src/levels/remote/fetch.js @@ -5,12 +5,14 @@ exports.level = { "name": { "en_US": "Git Fetchin'", "de_DE": "Git Fetch", - "zh_CN": "Git Fetchin'" + "zh_CN": "Git Fetchin'", + "zh_TW": "Git Fetchin'" }, "hint": { "en_US": "just run git fetch!", "de_DE": "Einfach git fetch ausführen!", - "zh_CN": "just run git fetch!" + "zh_CN": "just run git fetch!", + "zh_TW": "只要下 git fetch 指令" }, "startDialog": { "en_US": { @@ -86,6 +88,79 @@ exports.level = { } ] }, + "zh_TW": { + "childViews": [ + { + "type": "ModalAlert", + "options": { + "markdowns": [ + "## Git Fetch", + "", + "透過 git remotes 其實就是把資料接收或傳送到其它的 repository,只要我們可以將資料傳進及傳出,我們就可以分享任何被 git 所追蹤的 repository 的更新 (例如分享工作進度,新的檔案,新的想法,以及情書等等‧‧‧)。", + "", + "在這個教學中,我們會學習到如何從 remote repository 來 fetch (抓取) 資料,這個 command 叫作 `git fetch`。", + "", + "你將會注意到當我們的 remote repository 更新的時候,相對應的 _remote_ branch 也會反應該更新,這個跟我們之前所提到的 remote branch 的特性是吻合的。" + ] + } + }, + { + "type": "GitDemonstrationView", + "options": { + "beforeMarkdowns": [ + "在講到 `git fetch` 的細節之前,我們要先來看一下例子! 在這裡我們有一個包含了兩個 commit 的 remote repository,而且我們的 local repository 並沒有包含這兩個 commit。" + ], + "afterMarkdowns": [ + "看吧! commits `C2` and `C3` 已經被下載到我們的 local repository,而且我們的 remote branch `o/master` 也更新了。" + ], + "command": "git fetch", + "beforeCommand": "git clone; git fakeTeamwork 2" + } + }, + { + "type": "ModalAlert", + "options": { + "markdowns": [ + "### fetch 做了什麼", + "", + "`git fetch` 只有執行了兩個主要步驟。包含:", + "", + "* 下載 remote 有的 commit,但是在我們的 local repository 是沒有該 commit。還有‧‧‧", + "* 更新我們 remote branch 所指向的地方 (例如, `o/master`)", + "", + "基本上,`git fetch` 同步了我們的 local repository 以及 remote repository 的最新狀態。", + "", + "假如你還記得之前的教學的話,我們說過 remote branch 反應了 remote repository 的狀態,原因在於說你最後接觸的是這些 remote repository,而你就是利用 `git fetch` 來接觸這些 remote repository! 現在 remote branch 跟 `git fetch` 的關係已經很明顯了。", + "", + "`git fetch` 通常是透過網路來跟 remote 溝通。(透過一個 protocol (協定),例如 `http://` 或者是 `git://`).", + "" + ] + } + }, + { + "type": "ModalAlert", + "options": { + "markdowns": [ + "### fetch 沒有做什麼", + "", + "然而,`git fetch` 並不會影響到在你的 local repository 中的 `master` branch,他並不會將你的 `master` branch 更新到最新的狀態。", + "", + "這個觀念很重要,因為很多程式設計師以為 `git fetch` 可以讓他們在 local repository 上面的工作跟 remote repository 的工作可以同步。它是會下載同步所需的資料,但是不會更新任何的檔案,我們會在後面的教學中提到如何做到這件事情。:D", + "", + "因此,你可以把 `git fetch` 想成是在下載資料。" + ] + } + }, + { + "type": "ModalAlert", + "options": { + "markdowns": [ + "要完成這一關,只要透過 `git fetch` 並且下載全部的 commit 即可!" + ] + } + } + ] + }, "zh_CN":{ "childViews": [ { diff --git a/src/levels/remote/remoteBranches.js b/src/levels/remote/remoteBranches.js index 8a28dc9e..b14b6cce 100644 --- a/src/levels/remote/remoteBranches.js +++ b/src/levels/remote/remoteBranches.js @@ -5,11 +5,13 @@ exports.level = { "name": { "en_US": "Remote Branches", "zh_CN": "Remote Branches", + "zh_TW": "Remote Branches (遠端分支)", "de_DE": "Branches auf entfernten Servern" }, "hint": { "en_US": "Pay attention to the ordering -- commit on master first!", "zh_CN": "Pay attention to the ordering -- commit on master first!", + "zh_TW": "注意順序的問題喔!先在 master branch 上面 commit", "de_DE": "Beachte die Sortierung -- committe zuerst auf dem master!" }, "startDialog": { @@ -74,6 +76,67 @@ exports.level = { } ] }, + "zh_TW": { + "childViews": [ + { + "type": "ModalAlert", + "options": { + "markdowns": [ + "## Git Remote Branches", + "", + "現在你已經知道 `git clone` 在幹嘛了,讓我們仔細看看到底發生了什麼事。", + "", + "你首先看到的是在你的本地端 (local repository) 出現了一個新的 branch 叫作 `o/master`,這種型態的 branch 叫作 remote branch (遠端分支),因為特殊的需求,因此 remote branch 有特殊的性質。", + "", + "remote branch 反應了 remote repository 的狀態 (因為你最後接觸的是這些 remote repository),最重要的是,在你想要分享你的工作給其他人時,你必須知道你現在的工作跟 remote repository 有哪些不同,而 remote branch 的狀態就是在告訴你這些資訊。", + "", + "remote branch 有特別的特性,當你移動到 remote branch 時,你就進入到 detached `HEAD` 狀態,git 這樣做的原因是告訴你不能夠直接影響這些 branch。你必須要在其它的 branch 工作,並且分享到 remote。(分享之後,你的 remote branch 就會被更新)。" + ] + } + }, + { + "type": "ModalAlert", + "options": { + "markdowns": [ + "### 什麼是 `o/`?", + "", + "你也許會對於 remote branch 前面的 `o/` 感到困惑,喔! remote branch 也 (需要) 一個命名法則,或者是一般表示 remote branch 的格式。", + "", + "* `/`", + "", + "因此,當你看到一個 branch 叫做 `o/master`,就表示這個 branch 叫做 master,而且這個 remote 的名稱叫作 `o`。", + "", + "很多程式設計師實際上會把他們的 remote 命名為 `origin`,而不是 `o`,這在 git 是很常見的事情,因為當你使用 `git clone` 時,git 會自動把你的 remote 命名為 `origin`。", + "", + "但是很不幸的是 `origin` 並沒有辦法完全顯示在我們的 UI 上面,所以我們用 `o` 來簡化它 (只要記住當你使用 git 的時候,實際上是命名為 `origin`)。", + "", + "有很多事情需要說明,現在讓我們來看看吧!" + ] + } + }, + { + "type": "GitDemonstrationView", + "options": { + "beforeMarkdowns": [ + "讓我們移動到 (check out) 一個 remote branch 並且看一下會發生什麼事情" + ], + "afterMarkdowns": [ + "就像你看到的, git 讓我們進到 detached `HEAD` 狀態,同時,當我們加入一個新的 commit 時,`o/master` 都沒有更新,這是因為只有當 remote 更新的時候,`o/master` 才會更新。" + ], + "command": "git checkout o/master; git commit", + "beforeCommand": "git clone" + } + }, + { + "type": "ModalAlert", + "options": { + "markdowns": [ + "要完成這一關,先在 master branch 上面做一次 commit,再移動到 `o/master` 上做一次 commit,這有助於我們了解到 remote branch 的不同,它們只會反應 remote 的狀態。" + ] + } + } + ] + }, "de_DE": { "childViews": [ {