remote done

This commit is contained in:
mht 2014-04-24 11:27:40 +08:00
parent 0eaa98c895
commit 8ce93006b8
3 changed files with 256 additions and 0 deletions

View file

@ -5,11 +5,13 @@ exports.level = {
"name": { "name": {
"en_US": "Fetch arguments", "en_US": "Fetch arguments",
"zh_CN": "Fetch arguments", "zh_CN": "Fetch arguments",
"zh_TW": "Fetch 的參數",
"de_DE": "Optionen für Fetch" "de_DE": "Optionen für Fetch"
}, },
"hint": { "hint": {
"en_US": "Pay attention how the commit ids may have swapped! You can read slides again with \"help level\"", "en_US": "Pay attention how the commit ids may have swapped! You can read slides again with \"help level\"",
"zh_CN": "注意下提交对象的id是如何交换的! 你可以通过`help level`再次切到幻灯片!", "zh_CN": "注意下提交对象的id是如何交换的! 你可以通过`help level`再次切到幻灯片!",
"zh_TW": "注意 commit 的 id 是怎麼被交換的! 你可以透過 `help level` 來閱讀對話視窗!",
"de_DE": "Beachte wie die Commit IDs getauscht wurden! Du kannst den Einführungsdialog mit \"help level\" erneut anzeigen" "de_DE": "Beachte wie die Commit IDs getauscht wurden! Du kannst den Einführungsdialog mit \"help level\" erneut anzeigen"
}, },
"startDialog": { "startDialog": {
@ -136,6 +138,129 @@ exports.level = {
} }
] ]
}, },
"zh_TW": {
"childViews": [
{
"type": "ModalAlert",
"options": {
"markdowns": [
"## git fetch 的參數",
"",
"我們剛學到了所有關於 git push 的參數,有非常棒的 `<place>` 參數,甚至是 colon refspecs`<source>:<destination>`),我們可不可以也同樣套用到 `git fetch` 上面?",
"",
"你說得對!`git fetch` 的參數*非常非常*類似 `git push`,一樣的概念,但方向不同(因為你在下載 commit而不是在上傳 commit。",
"",
"讓我們一次講一個概念..."
]
}
},
{
"type": "ModalAlert",
"options": {
"markdowns": [
"###`<place>` 參數",
"",
"對於 `git fetch`,如果你特別指定了一個 `<place>`",
"",
"`git fetch origin foo`",
"",
"git 會到 remote 上的 `foo` branch抓下所有不在 local 上的 commit然後將它們放到 local 的 `o/foo` branch。",
"",
"讓我們實際看一下(就只是一個*更新*的方法)。"
]
}
},
{
"type": "GitDemonstrationView",
"options": {
"beforeMarkdowns": [
"指定一個 `<place>`..."
],
"afterMarkdowns": [
"我們只下載了 `foo` 上的 commit並且把它們放到 `o/foo`。"
],
"command": "git fetch origin foo",
"beforeCommand": "git branch foo; git clone; git fakeTeamwork foo 2"
}
},
{
"type": "ModalAlert",
"options": {
"markdowns": [
"你也許會感到奇怪,為什麼 git 是把這些 commit 放到 `o/foo` branch 而不是放到我的 local 的 `foo` branch 我認為,`<place>` 參數是表示一個位置,這個位置同時存在 local 跟 remote 上?",
"",
"因為你可能已經 checkout 到 `foo` branch 上,而且你不想要打亂上面的 commit因此 git 才會特別這樣做!! 這就又回到之前的 `git fetch` 的課程,它並不會放到你的 local 上的 branch (該 branch 沒有對應到任何的 remote branch),它只會下載 commit 到 local 上且表示 remote 的 branch所以你之後可以觀察/merge 它們)。",
""
]
}
},
{
"type": "ModalAlert",
"options": {
"markdowns": [
"\"在該例子當中,如果我特別透過 `<source>:<destination>` 來指定來源以及目的地,會發生什麼事情?\"",
"",
"如果你很想要把 fetch 回來的 commit *直接*放到 local branch那麼你就可以利用一個 colon refspec 來做到。你不能夠把 fetch 回來的 commit 放到你目前正 checkout 的 branch如果不是的話git 就會允許你這麼做。",
"",
"這裡只有一個重點,`<source>` 現在是一個在 *remote* 上的 branch而且 `<destination>` 是一個放置這些 commit 的 *local* 的位置。它剛好就是 `git push` 的相反,而且因為我們在相反方向傳遞資料,所以這也很合理!",
"",
"其實,程式設計師很少會想要做這個,我主要是強調 `fetch` 以及 `push` 的概念是很類似的,就只是方向相反而已。"
]
}
},
{
"type": "GitDemonstrationView",
"options": {
"beforeMarkdowns": [
"讓我們來實際看一下這個瘋狂的事情:"
],
"afterMarkdowns": [
"哇看到了吧git 把 `foo~1` 解讀成一個在 origin 上的位置,而且把該位置上面的 commit 下載到 `bar`(這是一個 local branch上面注意因為我們有指定目的地因此 `foo` 跟 `o/foo` 並沒有被更新。"
],
"command": "git fetch origin foo~1:bar",
"beforeCommand": "git branch foo; git clone; git branch bar; git fakeTeamwork foo 2"
}
},
{
"type": "GitDemonstrationView",
"options": {
"beforeMarkdowns": [
"如果我在執行這個指令之前,目的地不存在的話會怎樣?我們回到上一個例子,但這一次事前並沒有 `bar` 這個 branch 的存在。"
],
"afterMarkdowns": [
"看到了吧,這就像是 `git push`,在 fetch 之前git 會自己建立目的地,就好像是在 push 之前, git 會建立 remote 上的目的地一樣(如果它不存在的話)。"
],
"command": "git fetch origin foo~1:bar",
"beforeCommand": "git branch foo; git clone; git fakeTeamwork foo 2"
}
},
{
"type": "GitDemonstrationView",
"options": {
"beforeMarkdowns": [
"沒有參數的情況?",
"",
"如果使用 `git fetch` 的時候,沒有指定任何的參數,那就相當於它會下載 remote 上面的所有的 commit並且把這些 commit 放到 local 上面所有對應到 remote 的 branch..."
],
"afterMarkdowns": [
"超簡單,但是所有的更新只做一次,很值得。"
],
"command": "git fetch",
"beforeCommand": "git branch foo; git clone; git fakeTeamwork foo; git fakeTeamwork master"
}
},
{
"type": "ModalAlert",
"options": {
"markdowns": [
"好的談了好多要完成這一關fetch 視覺化的目標所指定的 commit好好玩這些指令吧",
"",
"對於兩個 fetch 的指令,你必須要指定來源以及目的地,注意一下視覺化的目標,因為 commit 的 id 可以被交換!"
]
}
}
]
},
"zh_CN": { "zh_CN": {
"childViews": [ "childViews": [
{ {

View file

@ -5,11 +5,13 @@ exports.level = {
"name": { "name": {
"en_US": "Pull arguments", "en_US": "Pull arguments",
"zh_CN": "Pull arguments", "zh_CN": "Pull arguments",
"zh_TW": "Pull 的參數",
"de_DE": "Optionen für Pull" "de_DE": "Optionen für Pull"
}, },
"hint": { "hint": {
"en_US": "Remember that you can create new local branches with fetch/pull arguments", "en_US": "Remember that you can create new local branches with fetch/pull arguments",
"zh_CN": "记住, 你可以通过fetch/pull创建本地分支", "zh_CN": "记住, 你可以通过fetch/pull创建本地分支",
"zh_TW": "記住,你可以透過 fetch/pull 來建立一個新的 local 的分支",
"de_DE": "Du kannst neue lokale Branches mittels fetch / pull erstellen" "de_DE": "Du kannst neue lokale Branches mittels fetch / pull erstellen"
}, },
"startDialog": { "startDialog": {
@ -87,6 +89,80 @@ exports.level = {
} }
] ]
}, },
"zh_TW": {
"childViews": [
{
"type": "ModalAlert",
"options": {
"markdowns": [
"## git pull 的參數",
"",
"現在你已經知道關於 `git fetch` 以及 `git push` 的*任何參數*,但是我們還可以再聊聊 `git pull`:)",
"",
"那是因為 `git pull` 到目前為止*的確*只是表示 fetch 之後再 merge 所 fetch 的 commit 你可以把它想成,當使用 `git fetch` 時使用*一樣*的參數,之後再從 fetch 下來的 commit *所放置*的位置做 merge。",
"",
"這同樣也適用於當你指定相當複雜的參數,讓我們來看一些例子:"
]
}
},
{
"type": "ModalAlert",
"options": {
"markdowns": [
"對於 git 來說,有一些意義一樣的指令:",
"",
"`git pull origin foo` 相當於:",
"",
"`git fetch origin foo; git merge o/foo`",
"",
"而且...",
"",
"`git pull origin bar~1:bugFix` 相當於:",
"",
"`git fetch origin bar~1:bugFix; git merge bugFix`",
"",
"看吧? `git pull` 真的就只是表示 fetch 跟 merge 的一個簡化後的指令,而且 `git pull` 所根據的是這些 commit 要放置的位置(在 fetch 的時候所指定的`目的地`)。",
"",
"讓我們來看一個例子:"
]
}
},
{
"type": "GitDemonstrationView",
"options": {
"beforeMarkdowns": [
"如果我們在 fetch 的時候有指定`位置`的話跟之前一樣fetch 所做的事情沒有變,但是我們會 merge 我們剛剛所 fetch 的該`位置`的commit。"
],
"afterMarkdowns": [
"看吧! 指定位置為 `master`,跟平常一樣,我們下載了 commit 並且放到 `o/master` 上,接著,我們會 merge `o/master` 到我們現在的位置,*不管*我們現在所 checkout 的位置在哪裡。"
],
"command": "git pull origin master",
"beforeCommand": "git clone; go -b bar; git commit; git fakeTeamwork"
}
},
{
"type": "GitDemonstrationView",
"options": {
"beforeMarkdowns": [
"他是不是也可以同時指定來源以及目的地?你說對了啦!讓我們來看一下:"
],
"afterMarkdowns": [
"哇!這個指令強而有力,我們在 local 建立了一個新的 `foo` branch下載了 remote 的 `master` 的 commit並且放到 local 的 `foo` branch之後 merge `foo` branch 到我們目前所 checkout 的 `bar` branch。 這實在是在超過了!!!"
],
"command": "git pull origin master:foo",
"beforeCommand": "git clone; git fakeTeamwork; go -b bar; git commit"
}
},
{
"type": "ModalAlert",
"options": {
"markdowns": [
"要完成這一關,達到視覺化目標的要求,你需要下載一些 commit建立一些新的 branch並且 merge 這些 branch 到其他的 branch 上面,這個關卡不需要打太多的指令:P"
]
}
}
]
},
"zh_CN":{ "zh_CN":{
"childViews": [ "childViews": [
{ {

View file

@ -5,11 +5,13 @@ exports.level = {
"name": { "name": {
"en_US": "Source of nothing", "en_US": "Source of nothing",
"zh_CN": "没有source", "zh_CN": "没有source",
"zh_TW": "沒有 source",
"de_DE": "Die Quelle des Nichts" "de_DE": "Die Quelle des Nichts"
}, },
"hint": { "hint": {
"en_US": "The branch command is disabled for this level so you'll have to use fetch!", "en_US": "The branch command is disabled for this level so you'll have to use fetch!",
"zh_CN": "本节的分支命令被禁用了, 你只能使用fetch! ", "zh_CN": "本节的分支命令被禁用了, 你只能使用fetch! ",
"zh_TW": "在本關卡中,不允許使用 branch 指令,因此你只能使用 fetch!",
"de_DE": "Der branch Befehl ist für diesen Level inaktiv, du musst also fetch benutzen" "de_DE": "Der branch Befehl ist für diesen Level inaktiv, du musst also fetch benutzen"
}, },
"startDialog": { "startDialog": {
@ -66,6 +68,59 @@ exports.level = {
} }
] ]
}, },
"zh_TW": {
"childViews": [
{
"type": "ModalAlert",
"options": {
"markdowns": [
"###`<source>` 奇怪的地方",
"",
"在兩個奇怪的情況下git 不使用 `<source>` 參數,事實上,在`git push`以及`git fetch`的情況下,可以允許你\"不用\"指定`來源`,你可以藉由把參數留空,來表示你不想指定來源:",
"",
"* `git push origin :side`",
"* `git fetch origin :bugFix`",
"",
"讓我們來看看這些在做什麼..."
]
}
},
{
"type": "GitDemonstrationView",
"options": {
"beforeMarkdowns": [
"當*沒有*指定來源的時候,`push` 對於 remote branch 做了什麼?`push`把它刪除掉了!"
],
"afterMarkdowns": [
"看吧,我們藉由把來源\"留空\",成功用 `push` 刪除了 `foo` branch這合理吧..."
],
"command": "git push origin :foo",
"beforeCommand": "git clone; git push origin master:foo"
}
},
{
"type": "GitDemonstrationView",
"options": {
"beforeMarkdowns": [
"最後,對於 `fetch` 來說,來源 \"留空\" 表示我們要在 local 上建立一個新的 branch。"
],
"afterMarkdowns": [
"很奇怪,但那正是 git 為你做的事情!"
],
"command": "git fetch origin :bar",
"beforeCommand": "git clone"
}
},
{
"type": "ModalAlert",
"options": {
"markdowns": [
"這是一個很簡單的關卡,只需要利用 `git push` 刪除一個 remote 的 branch並且利用 `git fetch` 建立一個新的 local 的 branch"
]
}
}
]
},
"zh_CN":{ "zh_CN":{
"childViews": [ "childViews": [
{ {