mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-25 07:28:35 +02:00
almost done
This commit is contained in:
parent
1d2c6a8d82
commit
fc8e12bb56
11 changed files with 191 additions and 65 deletions
|
@ -288,7 +288,7 @@ exports.level = {
|
||||||
"",
|
"",
|
||||||
"這不是用來指定往上回去幾代(`~` 的作用),`^` 後面所跟的數字表示我要選擇哪一個 parent commit。還記得一個 merge commit 可以有多個 parent commit 吧,所以當我們要選擇走到哪一個 parent commit 的時候就會比較麻煩了。",
|
"這不是用來指定往上回去幾代(`~` 的作用),`^` 後面所跟的數字表示我要選擇哪一個 parent commit。還記得一個 merge commit 可以有多個 parent commit 吧,所以當我們要選擇走到哪一個 parent commit 的時候就會比較麻煩了。",
|
||||||
"",
|
"",
|
||||||
"Git 預設會選擇 merge commit 的\"第一個\" parent commit,使用`^`後面接一個數字可以改變這個預設的行為。",
|
"git 預設會選擇 merge commit 的\"第一個\" parent commit,使用 `^` 後面接一個數字可以改變這個預設的行為。",
|
||||||
"",
|
"",
|
||||||
"廢話不多說,舉一個例子。",
|
"廢話不多說,舉一個例子。",
|
||||||
""
|
""
|
||||||
|
@ -304,7 +304,7 @@ exports.level = {
|
||||||
"(*在我們的圖示中,第一個 parent commit 是指 merge commit 正上方的那一個 parent commit。*)"
|
"(*在我們的圖示中,第一個 parent commit 是指 merge commit 正上方的那一個 parent commit。*)"
|
||||||
],
|
],
|
||||||
"afterMarkdowns": [
|
"afterMarkdowns": [
|
||||||
"簡單吧--這就是預設的情況。"
|
"簡單吧!這就是預設的情況。"
|
||||||
],
|
],
|
||||||
"command": "git checkout master^",
|
"command": "git checkout master^",
|
||||||
"beforeCommand": "git checkout HEAD^; git commit; git checkout master; git merge C2"
|
"beforeCommand": "git checkout HEAD^; git commit; git checkout master; git merge C2"
|
||||||
|
@ -314,7 +314,7 @@ exports.level = {
|
||||||
"type": "GitDemonstrationView",
|
"type": "GitDemonstrationView",
|
||||||
"options": {
|
"options": {
|
||||||
"beforeMarkdowns": [
|
"beforeMarkdowns": [
|
||||||
"現在來試試選擇第二個 parent commit……"
|
"現在來試試選擇第二個 parent commit..."
|
||||||
],
|
],
|
||||||
"afterMarkdowns": [
|
"afterMarkdowns": [
|
||||||
"看到了嗎?我們回到了第二個 parent commit。"
|
"看到了嗎?我們回到了第二個 parent commit。"
|
||||||
|
@ -355,7 +355,7 @@ exports.level = {
|
||||||
"markdowns": [
|
"markdowns": [
|
||||||
"### 練習一下",
|
"### 練習一下",
|
||||||
"",
|
"",
|
||||||
"要完成這一關,在指定的目標位置上面建立一個新的分支。",
|
"要完成這一關,在指定的目標位置上面建立一個新的 branch。",
|
||||||
"",
|
"",
|
||||||
"很明顯可以直接使用 commit 的 hash 值(比如 `C6`),但我要求你使用剛剛講到的相對引用的符號!"
|
"很明顯可以直接使用 commit 的 hash 值(比如 `C6`),但我要求你使用剛剛講到的相對引用的符號!"
|
||||||
]
|
]
|
||||||
|
|
|
@ -4,11 +4,13 @@ exports.level = {
|
||||||
"startTree": "{\"branches\":{\"master\":{\"target\":\"C2\",\"id\":\"master\",\"remoteTrackingBranchID\":null},\"side\":{\"target\":\"C4\",\"id\":\"side\",\"remoteTrackingBranchID\":null},\"bugFix\":{\"target\":\"C6\",\"id\":\"bugFix\",\"remoteTrackingBranchID\":null}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C2\":{\"parents\":[\"C1\"],\"id\":\"C2\"},\"C3\":{\"parents\":[\"C1\"],\"id\":\"C3\"},\"C4\":{\"parents\":[\"C3\"],\"id\":\"C4\"},\"C5\":{\"parents\":[\"C3\"],\"id\":\"C5\"},\"C6\":{\"parents\":[\"C5\"],\"id\":\"C6\"}},\"tags\":{\"v0\":{\"target\":\"C0\",\"id\":\"v0\",\"type\":\"tag\"},\"v1\":{\"target\":\"C3\",\"id\":\"v1\",\"type\":\"tag\"}},\"HEAD\":{\"target\":\"bugFix\",\"id\":\"HEAD\"}}",
|
"startTree": "{\"branches\":{\"master\":{\"target\":\"C2\",\"id\":\"master\",\"remoteTrackingBranchID\":null},\"side\":{\"target\":\"C4\",\"id\":\"side\",\"remoteTrackingBranchID\":null},\"bugFix\":{\"target\":\"C6\",\"id\":\"bugFix\",\"remoteTrackingBranchID\":null}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C2\":{\"parents\":[\"C1\"],\"id\":\"C2\"},\"C3\":{\"parents\":[\"C1\"],\"id\":\"C3\"},\"C4\":{\"parents\":[\"C3\"],\"id\":\"C4\"},\"C5\":{\"parents\":[\"C3\"],\"id\":\"C5\"},\"C6\":{\"parents\":[\"C5\"],\"id\":\"C6\"}},\"tags\":{\"v0\":{\"target\":\"C0\",\"id\":\"v0\",\"type\":\"tag\"},\"v1\":{\"target\":\"C3\",\"id\":\"v1\",\"type\":\"tag\"}},\"HEAD\":{\"target\":\"bugFix\",\"id\":\"HEAD\"}}",
|
||||||
"name": {
|
"name": {
|
||||||
"en_US": "Git Describe",
|
"en_US": "Git Describe",
|
||||||
"de_DE": "Git Describe"
|
"de_DE": "Git Describe",
|
||||||
|
"zh_TW": "git describe"
|
||||||
},
|
},
|
||||||
"hint": {
|
"hint": {
|
||||||
"en_US": "Just commit once on bugFix when you're ready to move on",
|
"en_US": "Just commit once on bugFix when you're ready to move on",
|
||||||
"de_DE": "Committe nur einmal auf bugFix, wenn du soweit bist"
|
"de_DE": "Committe nur einmal auf bugFix, wenn du soweit bist",
|
||||||
|
"zh_TW": "當你要移動的時候,只要在 bugFix 上面 commit 就好了"
|
||||||
},
|
},
|
||||||
"startDialog": {
|
"startDialog": {
|
||||||
"en_US": {
|
"en_US": {
|
||||||
|
@ -74,6 +76,69 @@ exports.level = {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"zh_TW": {
|
||||||
|
"childViews": [
|
||||||
|
{
|
||||||
|
"type": "ModalAlert",
|
||||||
|
"options": {
|
||||||
|
"markdowns": [
|
||||||
|
"### git describe",
|
||||||
|
"",
|
||||||
|
"因為 tag 在 commit tree 上表示的是一個錨點,git 有一個指令可以用來*顯示*離你最近的錨點(也就是 tag),而且這個指令叫做 `git describe`!",
|
||||||
|
"",
|
||||||
|
"當你已經完成了一個 `git bisect`(一個找尋有 bug 的 commit 的指令),或者是當你使用的是你跑去度假的同事的電腦時, `git describe` 可以幫助你了解你離最近的 tag 差了多少個 commit。"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ModalAlert",
|
||||||
|
"options": {
|
||||||
|
"markdowns": [
|
||||||
|
"`git describe` 的使用方式:",
|
||||||
|
"",
|
||||||
|
"`git describe <ref>`",
|
||||||
|
"",
|
||||||
|
"`<ref>` 是任何一個可以被 git 解讀成 commit 的位置,如果你沒有指定的話,git 會以你目前所在的位置為準(`HEAD`)。",
|
||||||
|
"",
|
||||||
|
"指令的輸出就像這樣:",
|
||||||
|
"",
|
||||||
|
"`<tag>_<numCommits>_g<hash>`",
|
||||||
|
"",
|
||||||
|
"`<tag>` 表示的是離 `<ref>` 最近的 tag, `numCommits` 是表示這個 tag 離 `<ref>` 有多少個 commit, `<hash>` 表示的是你所給定的 `<ref>` 所表示的 commit 的前七個 id。"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "GitDemonstrationView",
|
||||||
|
"options": {
|
||||||
|
"beforeMarkdowns": [
|
||||||
|
"讓我們來看一個例子,對於下面的 tree:"
|
||||||
|
],
|
||||||
|
"afterMarkdowns": [
|
||||||
|
"`git describe master` 會輸出:",
|
||||||
|
"",
|
||||||
|
"`v1_2_gC2`",
|
||||||
|
"",
|
||||||
|
"`git describe side` 會輸出:",
|
||||||
|
"",
|
||||||
|
"`v2_1_gC4`"
|
||||||
|
],
|
||||||
|
"command": "git tag v2 C3",
|
||||||
|
"beforeCommand": "git commit; go -b side HEAD~1; gc; gc; git tag v1 C0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ModalAlert",
|
||||||
|
"options": {
|
||||||
|
"markdowns": [
|
||||||
|
"`git describe` 就是這樣了!試著在這個關卡指定幾個位置來感受一下這個指令吧!",
|
||||||
|
"",
|
||||||
|
"當你完成的時候,只要一個 commit 就可以結束這個關卡,我們會給你一個免費贈品:P"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"de_DE": {
|
"de_DE": {
|
||||||
"childViews": [
|
"childViews": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -86,7 +86,7 @@ exports.level = {
|
||||||
"markdowns": [
|
"markdowns": [
|
||||||
"你說對了!git tag 可以解決這個問題,它們可以永遠地指向某個特定的 commit,就像是表示一個\"里程碑\"一樣。",
|
"你說對了!git tag 可以解決這個問題,它們可以永遠地指向某個特定的 commit,就像是表示一個\"里程碑\"一樣。",
|
||||||
"",
|
"",
|
||||||
"更重要的是,當有新的 commit 時,它們也不會移動,你可以 \"checkout\" 到 tag 上面,並且在上面 commit,tag 的存在就像是一個在 commit tree 上的表示特定訊息的一個錨。",
|
"更重要的是,當有新的 commit 時,它們也不會移動,你不可以 \"checkout\" 到 tag 上面 commit,tag 的存在就像是一個在 commit tree 上的表示特定訊息的一個錨。",
|
||||||
"",
|
"",
|
||||||
"讓我們來實際看一下 tag 長什麼樣子..."
|
"讓我們來實際看一下 tag 長什麼樣子..."
|
||||||
]
|
]
|
||||||
|
@ -109,7 +109,7 @@ exports.level = {
|
||||||
"type": "ModalAlert",
|
"type": "ModalAlert",
|
||||||
"options": {
|
"options": {
|
||||||
"markdowns": [
|
"markdowns": [
|
||||||
"在這個關卡中,建立一個如視覺化目標裡面的 tag,然後 checkout 到 `v1` 上面,要注意你會進到 detached `HEAD` 的狀態,這是因為你不能夠直接在 `v1` 上面做 commit。",
|
"在這個關卡中,建立一個如視覺化目標裡面的 tag,然後 checkout 到 `v1` 上面,要注意你會進到分離 `HEAD` 的狀態,這是因為你不能夠直接在 `v1` 上面做 commit。",
|
||||||
"",
|
"",
|
||||||
"在下個關卡中我們會介紹更多 tag 的應用..."
|
"在下個關卡中我們會介紹更多 tag 的應用..."
|
||||||
]
|
]
|
||||||
|
|
|
@ -9,12 +9,14 @@ exports.level = {
|
||||||
"name": {
|
"name": {
|
||||||
"en_US": "Cherry-pick Intro",
|
"en_US": "Cherry-pick Intro",
|
||||||
"de_DE": "Einführung Cherry-picking",
|
"de_DE": "Einführung Cherry-picking",
|
||||||
"zh_CN": "Cherry-pick Intro"
|
"zh_CN": "Cherry-pick Intro",
|
||||||
|
"zh_TW": "介紹 cherry-pick"
|
||||||
},
|
},
|
||||||
"hint": {
|
"hint": {
|
||||||
"en_US": "git cherry-pick followed by commit names!",
|
"en_US": "git cherry-pick followed by commit names!",
|
||||||
"de_DE": "git cherry-pick gefolgt von Commit-Namen.",
|
"de_DE": "git cherry-pick gefolgt von Commit-Namen.",
|
||||||
"zh_CN": "git cherry-pick 跟提交对句名"
|
"zh_CN": "git cherry-pick 跟提交对句名",
|
||||||
|
"zh_TW": "git cherry-pick 後面要接著 commit 的名稱"
|
||||||
},
|
},
|
||||||
"startDialog": {
|
"startDialog": {
|
||||||
"en_US": {
|
"en_US": {
|
||||||
|
@ -74,6 +76,63 @@ exports.level = {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"zh_TW": {
|
||||||
|
"childViews": [
|
||||||
|
{
|
||||||
|
"type": "ModalAlert",
|
||||||
|
"options": {
|
||||||
|
"markdowns": [
|
||||||
|
"移動 commit",
|
||||||
|
"",
|
||||||
|
"目前為止我們已經講了 git 的基礎,這些基礎包括 commit、branch 以及在 commit tree 中移動,只要有這些概念你就能發揮 git 90% 的功力,而且對於程式設計師來說,這樣就很夠了。",
|
||||||
|
"",
|
||||||
|
"而剩下的 10%,在很複雜的專案上面,是非常有用的(或者當你陷入困惑時),我們下一個要講的概念是 \"移動 commit\",換句話說,當你會這個非常有彈性的招數之後,你就可以說\"我想要把這個 commit 放這裡,而那個 commit 放在那裡\"。",
|
||||||
|
"",
|
||||||
|
"這看起來很複雜,但其實它很簡單。"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ModalAlert",
|
||||||
|
"options": {
|
||||||
|
"markdowns": [
|
||||||
|
"## git cherry-pick",
|
||||||
|
"",
|
||||||
|
"我們要講的第一個指令叫作 `git cherry-pick`,它的用法如下:",
|
||||||
|
"",
|
||||||
|
"* `git cherry-pick <Commit1> <Commit2> <...>`",
|
||||||
|
"",
|
||||||
|
"當你想要複製幾個 commit 並且接在你目前的位置(`HEAD`)下面的時候,這會是一個非常直接的方式。我個人非常喜歡用 `cherry-pick`,因為它並不複雜,很容易就可以了解。",
|
||||||
|
"",
|
||||||
|
"讓我們來看一個例子!",
|
||||||
|
""
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "GitDemonstrationView",
|
||||||
|
"options": {
|
||||||
|
"beforeMarkdowns": [
|
||||||
|
"這裡有一個 repo,在 `side` branch 中,我們有一些 commit 想要複製到 `master` branch 上,這可以透過一個 rebase 來完成(我們之前已經學到了),但是讓我們看看 `git cherry-pick` 怎麼做。"
|
||||||
|
],
|
||||||
|
"afterMarkdowns": [
|
||||||
|
"就是那樣!我們複製了 `C2` 以及 `C4` 並且把它們放到我們的後面,很簡單吧!"
|
||||||
|
],
|
||||||
|
"command": "git cherry-pick C2 C4",
|
||||||
|
"beforeCommand": "git checkout -b side; git commit; git commit; git commit; git checkout master; git commit;"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ModalAlert",
|
||||||
|
"options": {
|
||||||
|
"markdowns": [
|
||||||
|
"要完成這個關卡,只需要從三個 branch 複製幾個 commit 到 `master` 下面,你可以從視覺化的目標看到我們需要哪些 commit。",
|
||||||
|
""
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"zh_CN": {
|
"zh_CN": {
|
||||||
"childViews": [
|
"childViews": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -255,9 +255,9 @@ exports.level = {
|
||||||
"type": "ModalAlert",
|
"type": "ModalAlert",
|
||||||
"options": {
|
"options": {
|
||||||
"markdowns": [
|
"markdowns": [
|
||||||
"## 在 Git 中前後移動",
|
"## 在 git 中前後移動",
|
||||||
"",
|
"",
|
||||||
"在接觸 Git 的更多進階的主題之前,我們先學習用不同的方法在你的 project 中的 commit tree 上面移動。",
|
"在接觸 git 的更多進階的主題之前,我們先學習用不同的方法在你的 project 中的 commit tree 上面移動。",
|
||||||
"",
|
"",
|
||||||
"一旦能夠熟練地在 commit tree 中隨意地移動,你使用其它的 git 指令也會更厲害!",
|
"一旦能夠熟練地在 commit tree 中隨意地移動,你使用其它的 git 指令也會更厲害!",
|
||||||
"",
|
"",
|
||||||
|
@ -274,11 +274,11 @@ exports.level = {
|
||||||
"markdowns": [
|
"markdowns": [
|
||||||
"## HEAD",
|
"## HEAD",
|
||||||
"",
|
"",
|
||||||
"我們首先看一下 \"HEAD\",HEAD 是一個 reference,它是指向目前所 checkout 的 commit -- 基本上,其實就是你目前所在的 commit。",
|
"我們首先看一下 \"HEAD\",HEAD 是一個 reference,它是指向目前所 checkout 的 commit,基本上,其實就是你目前所在的 commit。",
|
||||||
"",
|
"",
|
||||||
"在 working tree 中,HEAD 總是指向最近的一次commit。大部份 git 的指令如果要修改 working tree 的狀態的話,都會先改變 HEAD 所指向的 commit。",
|
"在 commit tree 中,HEAD 總是指向最近的一次commit。大部份 git 的指令如果要修改 commit tree 的狀態的話,都會先改變 HEAD 所指向的 commit。",
|
||||||
"",
|
"",
|
||||||
"HEAD 通常指向一個分支的名稱(比如 bugFix)。當你 commit 的時候,改變了 bugFix 的狀態,這一個變化可以從 HEAD 的改變中看到。"
|
"HEAD 通常指向一個 branch 的名稱(比如 bugFix)。當你 commit 的時候,改變了 bugFix 的狀態,這一個變化可以從 HEAD 的改變中看到。"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -301,7 +301,7 @@ exports.level = {
|
||||||
"beforeMarkdowns": [
|
"beforeMarkdowns": [
|
||||||
"### 分離 HEAD",
|
"### 分離 HEAD",
|
||||||
"",
|
"",
|
||||||
"分離 HEAD 就是讓其指向一個 commit 而不是分支的名稱。這是命令執行之前的樣子: ",
|
"分離 HEAD 就是讓其指向一個 commit 而不是 branch 的名稱。這是指令執行之前的樣子:",
|
||||||
"",
|
"",
|
||||||
"HEAD -> master -> C1",
|
"HEAD -> master -> C1",
|
||||||
""
|
""
|
||||||
|
|
|
@ -8,12 +8,14 @@ exports.level = {
|
||||||
"startTree": "{\"branches\":{\"master\":{\"target\":\"C5\",\"id\":\"master\"},\"overHere\":{\"target\":\"C1\",\"id\":\"overHere\"}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C2\":{\"parents\":[\"C1\"],\"id\":\"C2\"},\"C3\":{\"parents\":[\"C2\"],\"id\":\"C3\"},\"C4\":{\"parents\":[\"C3\"],\"id\":\"C4\"},\"C5\":{\"parents\":[\"C4\"],\"id\":\"C5\"}},\"HEAD\":{\"target\":\"master\",\"id\":\"HEAD\"}}",
|
"startTree": "{\"branches\":{\"master\":{\"target\":\"C5\",\"id\":\"master\"},\"overHere\":{\"target\":\"C1\",\"id\":\"overHere\"}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C2\":{\"parents\":[\"C1\"],\"id\":\"C2\"},\"C3\":{\"parents\":[\"C2\"],\"id\":\"C3\"},\"C4\":{\"parents\":[\"C3\"],\"id\":\"C4\"},\"C5\":{\"parents\":[\"C4\"],\"id\":\"C5\"}},\"HEAD\":{\"target\":\"master\",\"id\":\"HEAD\"}}",
|
||||||
"hint": {
|
"hint": {
|
||||||
"en_US": "you can use either branches or relative refs (HEAD~) to specify the rebase target",
|
"en_US": "you can use either branches or relative refs (HEAD~) to specify the rebase target",
|
||||||
"de_DE": "Du kannst entweder Branches oder relative Ref-Angaben (z.B. HEAD~) benutzen, um das Ziel des Rebase anzugeben."
|
"de_DE": "Du kannst entweder Branches oder relative Ref-Angaben (z.B. HEAD~) benutzen, um das Ziel des Rebase anzugeben.",
|
||||||
|
"zh_TW": "你可以指定 branch 或者是相對位置(HEAD~)來表示 rebase 的目標"
|
||||||
},
|
},
|
||||||
"name": {
|
"name": {
|
||||||
"en_US": "Interactive Rebase Intro",
|
"en_US": "Interactive Rebase Intro",
|
||||||
"de_DE": "Einführung Interactive Rebase",
|
"de_DE": "Einführung Interactive Rebase",
|
||||||
"zh_CN": "Rebase 交互命令介绍 "
|
"zh_CN": "Rebase 交互命令介绍 ",
|
||||||
|
"zh_TW": "介紹互動式的 rebase"
|
||||||
},
|
},
|
||||||
"startDialog": {
|
"startDialog": {
|
||||||
"en_US": {
|
"en_US": {
|
||||||
|
@ -22,13 +24,13 @@ exports.level = {
|
||||||
"type": "ModalAlert",
|
"type": "ModalAlert",
|
||||||
"options": {
|
"options": {
|
||||||
"markdowns": [
|
"markdowns": [
|
||||||
"## Git Interactive Rebase",
|
"## git interactive rebase",
|
||||||
"",
|
"",
|
||||||
"Git cherry-pick is great when you know which commits you want (_and_ you know their corresponding hashes) -- it's hard to beat the simplicity it provides.",
|
"當你知道你要複製哪些 commit(而且你也知道他們所對應的 hash 值),那麼 `git cherry-pick` 很適合你。",
|
||||||
"",
|
"",
|
||||||
"But what about the situation where you don't know what commits you want? Thankfully git has you covered there as well! We can use interactive rebasing for this -- it's the best way to review a series of commits you're about to rebase.",
|
"但是如果你不知道你要的是哪些 commit 呢? 很幸運的是,git 也有考慮到這個問題喔!我們可以用互動式的 rebase 來做到,當你想要檢查你想要的 commit 的時候,這會是最好的方法。",
|
||||||
"",
|
"",
|
||||||
"Let's dive into the details..."
|
"讓我們來看一下這些細節..."
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -36,11 +38,11 @@ exports.level = {
|
||||||
"type": "ModalAlert",
|
"type": "ModalAlert",
|
||||||
"options": {
|
"options": {
|
||||||
"markdowns": [
|
"markdowns": [
|
||||||
"All interactive rebase means is using the `rebase` command with the `-i` option.",
|
"互動式的 rebase 相當於使用 rebase 這個指令的時候,後面加上一個 `-i` 的選項。",
|
||||||
"",
|
"",
|
||||||
"If you include this option, git will open up a UI to show you which commits are about to be copied below the target of the rebase. It also shows their commit hashes and messages, which is great for getting a bearing on what's what.",
|
"如果你有包含了這個選項,git 就會打開一個 UI,讓你知道說有哪些 commit 會被複製下來,它也會告訴你它們的 hash 值以及可以讓你知道它們是什麼的訊息。",
|
||||||
"",
|
"",
|
||||||
"For \"real\" git, the UI window means opening up a file in a text editor like `vim`. For our purposes, I've built a small dialog window that behaves the same way."
|
"在\"實務上\",UI 會利用一個編輯器(例如 vim)打開一個檔案,對於我們來說,我已經設計了一個有同樣功能的對話視窗。"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -48,11 +50,11 @@ exports.level = {
|
||||||
"type": "ModalAlert",
|
"type": "ModalAlert",
|
||||||
"options": {
|
"options": {
|
||||||
"markdowns": [
|
"markdowns": [
|
||||||
"When the interactive rebase dialog opens, you have the ability to do 3 things:",
|
"當互動式的 rebase 的對話視窗打開之後,你就可以做到三件事情:",
|
||||||
"",
|
"",
|
||||||
"* You can reorder commits simply by changing their order in the UI (in our window this means dragging and dropping with the mouse).",
|
"* 你可以藉由改變這些 commit 在 UI 的位置(在我們的視窗中,可以透過滑鼠去拖拉),來重新排序它們的順序。",
|
||||||
"* You can choose to completely omit some commits. This is designated by `pick` -- toggling `pick` off means you want to drop the commit.",
|
"* 你可以選擇完全忽略掉某些 commit,可以用滑鼠按一下,使它變暗,就表示你要忽略掉該 commit。",
|
||||||
"* Lastly, you can squash commits. Unfortunately our levels don't support this for a few logistical reasons, so I'll skip over the details of this. Long story short, though -- it allows you to combine commits.",
|
"* 最後, 你可以把 commit 合併在一起,但基於某些理由,在我們的關卡裡面並沒有這個功能。",
|
||||||
"",
|
"",
|
||||||
"Great! Let's see an example."
|
"Great! Let's see an example."
|
||||||
]
|
]
|
||||||
|
@ -62,10 +64,10 @@ exports.level = {
|
||||||
"type": "GitDemonstrationView",
|
"type": "GitDemonstrationView",
|
||||||
"options": {
|
"options": {
|
||||||
"beforeMarkdowns": [
|
"beforeMarkdowns": [
|
||||||
"When you hit the button, an interactive rebase window will appear. Reorder some commits around (or feel free to unpick some) and see the result!"
|
"當你按下按鈕的時候,一個互動式的 rebase 的視窗就會跳出來,重新排序一些 commit(大膽忽略掉某些 commit),然後看一下結果吧!"
|
||||||
],
|
],
|
||||||
"afterMarkdowns": [
|
"afterMarkdowns": [
|
||||||
"Boom! Git copied down commits in the exact same way you specified through the UI"
|
"看吧! git 根據你所選擇的 commit,把它們複製了下來。"
|
||||||
],
|
],
|
||||||
"command": "git rebase -i HEAD~4 --aboveAll",
|
"command": "git rebase -i HEAD~4 --aboveAll",
|
||||||
"beforeCommand": "git commit; git commit; git commit; git commit"
|
"beforeCommand": "git commit; git commit; git commit; git commit"
|
||||||
|
@ -75,7 +77,7 @@ exports.level = {
|
||||||
"type": "ModalAlert",
|
"type": "ModalAlert",
|
||||||
"options": {
|
"options": {
|
||||||
"markdowns": [
|
"markdowns": [
|
||||||
"To finish this level, do an interactive rebase and achieve the order shown in the goal visualization. Remember you can always `undo` or `reset` to fix mistakes :D"
|
"要完成這個關卡,使用互動式的 rebase,並且完成視覺化目標所表示 commit 的順序,記住!你可以經常使用 `undo` 或者 `reset` 來修正你的一些錯誤:D"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ exports.level = {
|
||||||
"en_US": "Remember the Caret (^) operator!",
|
"en_US": "Remember the Caret (^) operator!",
|
||||||
"de_DE": "Denk an den Dach-Operator (^)!",
|
"de_DE": "Denk an den Dach-Operator (^)!",
|
||||||
"zh_CN": "记住插入(^)操作符!",
|
"zh_CN": "记住插入(^)操作符!",
|
||||||
"zh_TW": "不要忘記插入(^) 符號!"
|
"zh_TW": "不要忘記插入(^)符號!"
|
||||||
},
|
},
|
||||||
"startDialog": {
|
"startDialog": {
|
||||||
"en_US": {
|
"en_US": {
|
||||||
|
@ -248,11 +248,11 @@ exports.level = {
|
||||||
"markdowns": [
|
"markdowns": [
|
||||||
"## 相對引用",
|
"## 相對引用",
|
||||||
"",
|
"",
|
||||||
"如果要在 Git 中移動,透過指定 commit 的 hash 值的方式會變得比較麻煩。在實際例子中,你的終端機上面不會出現漂亮且具備視覺效果的 commit tree,所以你不得不用 `git log` 來查詢 hash 值。",
|
"如果要在 git 中移動,透過指定 commit 的 hash 值的方式會變得比較麻煩。在實際例子中,你的終端機上面不會出現漂亮且具備視覺效果的 commit tree,所以你不得不用 `git log` 來查詢 hash 值。",
|
||||||
"",
|
"",
|
||||||
"另外,hash 值的長度在真實的 Git 環境中很長。舉個例子,前一個關卡的介紹中的 commit 的 hash 值是 `fed2da64c0efc5293610bdd892f82a58e8cbc5d8`。舌頭不要打結了...",
|
"另外,hash 值的長度在真實的 git 環境中很長。舉個例子,前一個關卡的介紹中的 commit 的 hash 值是 `fed2da64c0efc5293610bdd892f82a58e8cbc5d8`。舌頭不要打結了...",
|
||||||
"",
|
"",
|
||||||
"幸運的是, Git 對於處理 hash 很有一套。你只需要提供能夠唯一辨識出該 commit 的前幾個字元就可以了。所以,我可以只輸入 `fed2` 而不是上面的一長串字元。"
|
"幸運的是,git 對於處理 hash 值很有一套。你只需要提供能夠唯一辨識出該 commit 的前幾個字元就可以了。所以,我可以只輸入 `fed2` 而不是上面的一長串字元。"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -260,9 +260,9 @@ exports.level = {
|
||||||
"type": "ModalAlert",
|
"type": "ModalAlert",
|
||||||
"options": {
|
"options": {
|
||||||
"markdowns": [
|
"markdowns": [
|
||||||
"我說過,透過 hash 來指定 commit 不是很方便,所以 Git 加入了相對引用。這個就很厲害了!",
|
"我說過,透過 hash 值來指定 commit 不是很方便,所以 git 加入了相對引用。這個就很厲害了!",
|
||||||
"",
|
"",
|
||||||
"使用相對引用,你可以從一個易於記憶的地方(比如說分支名稱 `bugFix` 或 `HEAD`)開始工作。",
|
"使用相對引用,你可以從一個易於記憶的地方(比如說 branch 名稱 `bugFix` 或 `HEAD`)開始工作。",
|
||||||
"",
|
"",
|
||||||
"相對引用非常好用,這裡我介紹兩個簡單的用法:",
|
"相對引用非常好用,這裡我介紹兩個簡單的用法:",
|
||||||
"",
|
"",
|
||||||
|
@ -275,7 +275,7 @@ exports.level = {
|
||||||
"type": "GitDemonstrationView",
|
"type": "GitDemonstrationView",
|
||||||
"options": {
|
"options": {
|
||||||
"beforeMarkdowns": [
|
"beforeMarkdowns": [
|
||||||
"首先看看插入(^)這一個符號。把這個符號接在某一個 reference 後面,就表示你告訴 Git 去找到該 reference 所指向的 commit 的 parent commit。",
|
"首先看看插入(^)這一個符號。把這個符號接在某一個 reference 後面,就表示你告訴 git 去找到該 reference 所指向的 commit 的 parent commit。",
|
||||||
"",
|
"",
|
||||||
"所以 `master^` 相當於 \"`master` 的 parent commit\"。",
|
"所以 `master^` 相當於 \"`master` 的 parent commit\"。",
|
||||||
"",
|
"",
|
||||||
|
|
|
@ -212,9 +212,9 @@ exports.level = {
|
||||||
"type": "ModalAlert",
|
"type": "ModalAlert",
|
||||||
"options": {
|
"options": {
|
||||||
"markdowns": [
|
"markdowns": [
|
||||||
"### The \"~\" operator",
|
"### \"~\" 符號",
|
||||||
"",
|
"",
|
||||||
"假設需要在 commit tree 中向上移動多個 commit。使用太多`^`會非常討人厭,所以 Git 也加入了波浪(~)符號。",
|
"假設需要在 commit tree 中向上移動多個 commit。使用太多 `^` 會非常討人厭,所以 git 也加入了波浪(~)符號。",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"波浪符號後面可以選擇一個數字(你也可以不選擇),該數字可以告訴 Git 我要向上移動多少個 commit 。舉個例子"
|
"波浪符號後面可以選擇一個數字(你也可以不選擇),該數字可以告訴 Git 我要向上移動多少個 commit 。舉個例子"
|
||||||
|
|
|
@ -10,7 +10,7 @@ exports.level = {
|
||||||
"fr_FR": "Annuler des changements avec Git",
|
"fr_FR": "Annuler des changements avec Git",
|
||||||
"ko": "Git에서 작업 되돌리기",
|
"ko": "Git에서 작업 되돌리기",
|
||||||
"zh_CN": "在Git中撤销更改",
|
"zh_CN": "在Git中撤销更改",
|
||||||
"zh_TW": "在 Git 中取消修改 "
|
"zh_TW": "在 git 中取消修改 "
|
||||||
},
|
},
|
||||||
"hint": {
|
"hint": {
|
||||||
"en_US": "Notice that revert and reset take different arguments.",
|
"en_US": "Notice that revert and reset take different arguments.",
|
||||||
|
@ -343,11 +343,11 @@ exports.level = {
|
||||||
"type": "ModalAlert",
|
"type": "ModalAlert",
|
||||||
"options": {
|
"options": {
|
||||||
"markdowns": [
|
"markdowns": [
|
||||||
"## 取消 Git 的修改",
|
"## 取消 git 的修改",
|
||||||
"",
|
"",
|
||||||
"在 Git 裡面取消修改的方法很多。和 commit 一樣,在 Git 裡面取消修改同時具有底層的部份(暫存一些獨立的文件或者片段)和高層的部份(修改是如何被取消)。我們主要講的重點是後者。",
|
"在 git 裡面取消修改的方法很多。和 commit 一樣,在 git 裡面取消修改同時具有底層的部份(暫存一些獨立的文件或者片段)和高層的部份(修改是如何被取消)。我們主要講的重點是後者。",
|
||||||
"",
|
"",
|
||||||
"在 Git 裡主要用兩種方法來取消修改 —— 一種是 `git reset`,另外一種是 `git revert`。讓我們在下一個對話視窗中逐一瞭解它們。",
|
"在 git 裡主要用兩種方法來取消修改,一種是 `git reset`,另外一種是 `git revert`。讓我們在下一個對話視窗中逐一瞭解它們。",
|
||||||
""
|
""
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -358,13 +358,13 @@ exports.level = {
|
||||||
"beforeMarkdowns": [
|
"beforeMarkdowns": [
|
||||||
"## Git Reset",
|
"## Git Reset",
|
||||||
"",
|
"",
|
||||||
"`git reset` 把分支的參考點退回到上一個 commit 來取消修改。你可以認為這是在\"重寫歷史\"。`git reset` 往回移動分支,原來的分支所指向的commit好像從來沒有存在過一樣。",
|
"`git reset` 把分支的參考點退回到上一個 commit 來取消修改。你可以認為這是在\"重寫歷史\"。`git reset` 往回移動 branch,原來的 branch 所指向的 commit 好像從來沒有存在過一樣。",
|
||||||
"",
|
"",
|
||||||
"讓我們來看看要怎麼操作:"
|
"讓我們來看看要怎麼操作:"
|
||||||
],
|
],
|
||||||
"command": "git reset HEAD~1",
|
"command": "git reset HEAD~1",
|
||||||
"afterMarkdowns": [
|
"afterMarkdowns": [
|
||||||
"太好了! Git 把 master 分支簡單地移回到 `C1`;現在在我們的 local 端已經退回到沒有 commit 過 `C2` 的狀態了。"
|
"太好了! Git 把 master branch 簡單地移回到 `C1`;現在在我們的 local 已經退回到沒有 commit 過 `C2` 的狀態了。"
|
||||||
],
|
],
|
||||||
"beforeCommand": "git commit"
|
"beforeCommand": "git commit"
|
||||||
}
|
}
|
||||||
|
@ -375,7 +375,7 @@ exports.level = {
|
||||||
"beforeMarkdowns": [
|
"beforeMarkdowns": [
|
||||||
"## Git Revert",
|
"## Git Revert",
|
||||||
"",
|
"",
|
||||||
"雖然在你的 local 分支中使用 `git reset` 很方便,但是這種「改寫歷史」的方法對別人的遠端分支是無效的哦!",
|
"雖然在你的 local branch 中使用 `git reset` 很方便,但是這種「改寫歷史」的方法對別人的 remote branch 是無效的哦!",
|
||||||
"",
|
"",
|
||||||
"為了取消修改並且把這個狀態*分享*給別人,我們需要使用 `git revert`。舉個例子"
|
"為了取消修改並且把這個狀態*分享*給別人,我們需要使用 `git revert`。舉個例子"
|
||||||
],
|
],
|
||||||
|
@ -383,7 +383,7 @@ exports.level = {
|
||||||
"afterMarkdowns": [
|
"afterMarkdowns": [
|
||||||
"很奇怪吧!在我們要取消的 commit 後面居然多了一個新的 commit!這是因為新的 commit `C2'` 引入了*修改*——用來表示我們取消 `C2` 這個 commit 的修改。",
|
"很奇怪吧!在我們要取消的 commit 後面居然多了一個新的 commit!這是因為新的 commit `C2'` 引入了*修改*——用來表示我們取消 `C2` 這個 commit 的修改。",
|
||||||
"",
|
"",
|
||||||
"借助 revert,現在可以把你的修改分享給別人啦。"
|
"多虧了 revert,現在可以把你的修改分享給別人啦。"
|
||||||
],
|
],
|
||||||
"beforeCommand": "git commit"
|
"beforeCommand": "git commit"
|
||||||
}
|
}
|
||||||
|
@ -392,9 +392,9 @@ exports.level = {
|
||||||
"type": "ModalAlert",
|
"type": "ModalAlert",
|
||||||
"options": {
|
"options": {
|
||||||
"markdowns": [
|
"markdowns": [
|
||||||
"要完成這一關,分別取消 `local` 分支和 `pushed` 分支上的最近一次提交。",
|
"要完成這一關,分別取消 `local` branch 和 `pushed` branch 上的最近的一次 commit。",
|
||||||
"",
|
"",
|
||||||
"記住 `pushed` 是一個遠端分支,`local` 是一個本地分支 —— 有了這麼明顯的提示應該知道要用哪種方法了吧?"
|
"記住 `pushed` 是一個 remote branch,`local` 是一個 local branch,有了這麼明顯的提示應該知道要用哪種方法了吧?"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ exports.level = {
|
||||||
"ja": "最も効率的なやり方はmasterを最後に更新するだけかもしれない・・・",
|
"ja": "最も効率的なやり方はmasterを最後に更新するだけかもしれない・・・",
|
||||||
"ko": "아마도 master를 마지막에 업데이트하는 것이 가장 효율적인 방법일 것입니다...",
|
"ko": "아마도 master를 마지막에 업데이트하는 것이 가장 효율적인 방법일 것입니다...",
|
||||||
"zh_CN": "记住,最后更新master分支可能是最高效的方法。",
|
"zh_CN": "记住,最后更新master分支可能是最高效的方法。",
|
||||||
"zh_TW": "要記住喔! 把 master 分支留到最後在更新可能是最有效率的方法。"
|
"zh_TW": "要記住喔! 把 master branch 留到最後更新可能是最有效率的方法。"
|
||||||
},
|
},
|
||||||
"startDialog": {
|
"startDialog": {
|
||||||
"en_US": {
|
"en_US": {
|
||||||
|
@ -103,13 +103,13 @@ exports.level = {
|
||||||
"type": "ModalAlert",
|
"type": "ModalAlert",
|
||||||
"options": {
|
"options": {
|
||||||
"markdowns": [
|
"markdowns": [
|
||||||
"### Rebase 多個 branch",
|
"### rebase 多個 branch",
|
||||||
"",
|
"",
|
||||||
"嗨!現在我們有很多分支了啦!讓我們做一下rebase,將這些分支接到 master 分支上吧。",
|
"嗨!現在我們有很多 branch 了啦!讓我們做一下 rebase,將這些分支接到 master branch 上吧。",
|
||||||
"",
|
"",
|
||||||
"但是你的主管找了點麻煩 —— 他們希望得到有序的 commit history,也就是我們最終的結果是 `C7'` 在最下面,`C6'` 在它上面,以此類推。",
|
"但是你的主管找了點麻煩,他們希望得到有序的 commit history,也就是我們最終的結果是 `C7'` 在最下面,`C6'` 在它上面,以此類推。",
|
||||||
"",
|
"",
|
||||||
"假如你搞砸了,沒有關係啦!你用 `reset` 就可以重新開始!。記得看看我們提供的答案,看你是否能夠使用更少的指令完成這一關!"
|
"假如你搞砸了,沒有關係啦!你用 `reset` 就可以重新開始!記得看看我們提供的答案,看你是否能夠使用更少的指令完成這一關!"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ exports.level = {
|
||||||
"de_DE": "Branch-Spaghetti",
|
"de_DE": "Branch-Spaghetti",
|
||||||
"ja": "ブランチスパゲッティ",
|
"ja": "ブランチスパゲッティ",
|
||||||
"zh_CN": "分支浆糊",
|
"zh_CN": "分支浆糊",
|
||||||
"zh_TW": "分支漿糊"
|
"zh_TW": "branch 漿糊"
|
||||||
},
|
},
|
||||||
"hint": {
|
"hint": {
|
||||||
"en_US": "Make sure to do everything in the proper order! Branch one first, then two, then three",
|
"en_US": "Make sure to do everything in the proper order! Branch one first, then two, then three",
|
||||||
|
@ -20,7 +20,7 @@ exports.level = {
|
||||||
"ja": "全て正しい順番で処理すること!oneが最初で、次がtwo、最後にthreeを片付ける。",
|
"ja": "全て正しい順番で処理すること!oneが最初で、次がtwo、最後にthreeを片付ける。",
|
||||||
"ko": "이 문제를 해결하는 방법은 여러가지가 있습니다! 체리픽(cherry-pick)이 가장 쉽지만 오래걸리는 방법이고, 리베이스(rebase -i)가 빠른 방법입니다",
|
"ko": "이 문제를 해결하는 방법은 여러가지가 있습니다! 체리픽(cherry-pick)이 가장 쉽지만 오래걸리는 방법이고, 리베이스(rebase -i)가 빠른 방법입니다",
|
||||||
"zh_CN": "确保你是按照正确的顺序来操作!先操作分支 `one`, 然后 `two`, 最后才是 `three`",
|
"zh_CN": "确保你是按照正确的顺序来操作!先操作分支 `one`, 然后 `two`, 最后才是 `three`",
|
||||||
"zh_TW": "確認你是按照正確的順序來操作!先操作分支 `one`, 然後 `two`, 最後才是 `three`"
|
"zh_TW": "確認你是按照正確的順序來操作!先操作 branch `one`, 然後 `two`, 最後才是 `three`"
|
||||||
},
|
},
|
||||||
"startDialog": {
|
"startDialog": {
|
||||||
"en_US": {
|
"en_US": {
|
||||||
|
@ -113,11 +113,11 @@ exports.level = {
|
||||||
"",
|
"",
|
||||||
"哇塞大神!這關我們要來點不同的!",
|
"哇塞大神!這關我們要來點不同的!",
|
||||||
"",
|
"",
|
||||||
"現在我們的 `master` 分支是比 `one` `two` 和 `three` 這三個分支多了幾個 commit。由於某種原因,我們需要將 master 所新增的幾個 commit 套用到其它三個分支上面。",
|
"現在我們的 `master` branch 是比 `one` `two` 和 `three` 這三個 branch 多了幾個 commit。由於某種原因,我們需要將 master 所新增的幾個 commit 套用到其它三個 branch 上面。",
|
||||||
"",
|
"",
|
||||||
"分支 `one` 需要重新排序和取消 `C5` 這一個commit, `two` 需要完全重排,而 `three` 只需要再一個 commit。",
|
"`one` branch 需要重新排序和取消 `C5` 這一個 commit, `two` 需要完全重排,而 `three` 只需要再一個 commit。",
|
||||||
"",
|
"",
|
||||||
"我們會讓你知道如何解決這個問題 —— 之後請記得用 `show solution` 看看我們的答案喔。"
|
"我們會讓你知道如何解決這個問題,之後請記得用 `show solution` 看看我們的答案喔。"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue