mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-08-30 14:49:32 +02:00
Imported all zh_CN dialogs and added locale changing support Issue #42
This commit is contained in:
parent
2617357460
commit
cc5466b038
22 changed files with 1693 additions and 222 deletions
|
@ -7,9 +7,12 @@ exports.level = {
|
|||
"solutionCommand": "git checkout master;git cherry-pick C4",
|
||||
"startTree": "{\"branches\":{\"master\":{\"target\":\"C1\",\"id\":\"master\"},\"debug\":{\"target\":\"C2\",\"id\":\"debug\"},\"printf\":{\"target\":\"C3\",\"id\":\"printf\"},\"bugFix\":{\"target\":\"C4\",\"id\":\"bugFix\"}},\"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\"}},\"HEAD\":{\"target\":\"bugFix\",\"id\":\"HEAD\"}}",
|
||||
"name": "Grabbing Just 1 Commit",
|
||||
"hint": "Remember, interactive rebase or cherry-pick is your friend here",
|
||||
"hint": {
|
||||
"en_US": "Remember, interactive rebase or cherry-pick is your friend here",
|
||||
"zh_CN": "\u8bb0\u4f4f\uff0c\u4ea4\u4e92\u5f0f rebase \u6216\u8005 cherry-pick \u4f1a\u5f88\u6709\u5e2e\u52a9"
|
||||
},
|
||||
"startDialog": {
|
||||
"en": {
|
||||
"en_US": {
|
||||
"childViews": [
|
||||
{
|
||||
"type": "ModalAlert",
|
||||
|
@ -49,6 +52,47 @@ exports.level = {
|
|||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"zh_CN": {
|
||||
"childViews": [
|
||||
{
|
||||
"type": "ModalAlert",
|
||||
"options": {
|
||||
"markdowns": [
|
||||
"## 本地栈式提交 (Locally stacked commits)",
|
||||
"",
|
||||
"设想一下一个经常发生的场景:我在追踪一个有点棘手的 bug,为了更好地排查,我添加了一些 debug 语句和打印语句。",
|
||||
"",
|
||||
"所有的这些调试和打印语句到只在它们的分支里。最终我终于找到这个 bug,揪出来 fix 掉,然后撒花庆祝!",
|
||||
"",
|
||||
"但有个问题就是现在我要把 `bugFix` 分支的工作合并回 `master` 分支上,我可以简单地快进(fast-forward) `master` 分支,但这样的话 `master` 分支就会包含我这些调试语句了。"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ModalAlert",
|
||||
"options": {
|
||||
"markdowns": [
|
||||
"现在就是 Git 大显神通的时候啦。我们有几种方法来解决这个问题,但最直接的方法是:",
|
||||
"",
|
||||
"* `git rebase -i`",
|
||||
"* `git cherry-pick`",
|
||||
"",
|
||||
"交互(`-i`)衍合允许你选择哪些提交是要被保留,哪些要被舍弃。它允许你将提交重新排序。假如你要舍弃一些工作,这个会帮上很大的忙。",
|
||||
"",
|
||||
"Cherry-picking 能让你选择单独一个提交并且把它放到 `HEAD` 的最前端。"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ModalAlert",
|
||||
"options": {
|
||||
"markdowns": [
|
||||
"本关是可选关卡,玩不玩随便你。但是如果你坚持要刷,确保 `master` 分支能拿到 `bugFix` 分支的相关提交(references)。"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -8,9 +8,12 @@ exports.level = {
|
|||
"solutionCommand": "git rebase -i HEAD~2;git commit --amend;git rebase -i HEAD~2;git rebase caption master",
|
||||
"startTree": "{\"branches\":{\"master\":{\"target\":\"C1\",\"id\":\"master\"},\"newImage\":{\"target\":\"C2\",\"id\":\"newImage\"},\"caption\":{\"target\":\"C3\",\"id\":\"caption\"}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C2\":{\"parents\":[\"C1\"],\"id\":\"C2\"},\"C3\":{\"parents\":[\"C2\"],\"id\":\"C3\"}},\"HEAD\":{\"target\":\"caption\",\"id\":\"HEAD\"}}",
|
||||
"name": "Juggling Commits",
|
||||
"hint": "The first command is git rebase -i HEAD~2",
|
||||
"hint": {
|
||||
"en_US": "The first command is git rebase -i HEAD~2",
|
||||
"zh_CN": "\u7b2c\u4e00\u4e2a\u547d\u4ee4\u662f 'git rebase -i HEAD~2'"
|
||||
},
|
||||
"startDialog": {
|
||||
"en": {
|
||||
"en_US": {
|
||||
"childViews": [
|
||||
{
|
||||
"type": "ModalAlert",
|
||||
|
@ -48,6 +51,45 @@ exports.level = {
|
|||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"zh_CN": {
|
||||
"childViews": [
|
||||
{
|
||||
"type": "ModalAlert",
|
||||
"options": {
|
||||
"markdowns": [
|
||||
"## Juggling Commits",
|
||||
"",
|
||||
"下面这种情况也是经常出现的。例如你之前已经在 `newImage` 分支上做了一些提交,然后又在 `caption` 分支上做了一些相关的提交,因此它们看起来是一个连一个的(stacked on top of each other in your repository)。",
|
||||
"",
|
||||
"有点棘手的就是有时候你又想往先前的提交里做些小改动。呐,现在就是设计师想要我们去轻微改变下 `newImage` 的内容(change the dimensions slightly),尽管那个提交是很久很久以前的了。"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ModalAlert",
|
||||
"options": {
|
||||
"markdowns": [
|
||||
"为了实现他的愿望,我们可以按照下面的方法来做:",
|
||||
"",
|
||||
"* 先用 `git rebase -i` 将提交重新排序,然后把我们想要修改的提交挪到最前",
|
||||
"* 然后用 `commit --amend` 来进行一些小修改",
|
||||
"* 接着再用 `git rebase -i` 来将他们按最开始的顺序重新排好",
|
||||
"* 最后我们把 master 移到修改的最前端(用你自己喜欢的方法),就大功告成啦!",
|
||||
"",
|
||||
"当然还有许多方法可以完成这个任务(我知道你在看 cherry-pick 啦),之后我们会多点关注这些技巧啦,但现在暂时只专注上面这种方法。"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ModalAlert",
|
||||
"options": {
|
||||
"markdowns": [
|
||||
"啊最后还要提醒你一下最终的形式 —— 因为我们把这个提交移动了两次,所以会分别产生一个省略提交(both get an apostrophe appended)。还有一个省略提交是因为我们为了实现最终效果去修改提交而添加的。"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -7,9 +7,12 @@ exports.level = {
|
|||
"startTree": "{\"branches\":{\"master\":{\"target\":\"C1\",\"id\":\"master\"},\"newImage\":{\"target\":\"C2\",\"id\":\"newImage\"},\"caption\":{\"target\":\"C3\",\"id\":\"caption\"}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C2\":{\"parents\":[\"C1\"],\"id\":\"C2\"},\"C3\":{\"parents\":[\"C2\"],\"id\":\"C3\"}},\"HEAD\":{\"target\":\"caption\",\"id\":\"HEAD\"}}",
|
||||
"compareOnlyMaster": true,
|
||||
"name": "Juggling Commits #2",
|
||||
"hint": "Don't forget to forward master to the updated changes!",
|
||||
"hint": {
|
||||
"en_US": "Don't forget to forward master to the updated changes!",
|
||||
"zh_CN": "\u522b\u5fd8\u8bb0\u4e86\u5c06 master \u5feb\u8fdb\u5230\u6700\u65b0\u7684\u66f4\u65b0\u4e0a\uff01"
|
||||
},
|
||||
"startDialog": {
|
||||
"en": {
|
||||
"en_US": {
|
||||
"childViews": [
|
||||
{
|
||||
"type": "ModalAlert",
|
||||
|
@ -49,6 +52,47 @@ exports.level = {
|
|||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"zh_CN": {
|
||||
"childViews": [
|
||||
{
|
||||
"type": "ModalAlert",
|
||||
"options": {
|
||||
"markdowns": [
|
||||
"## Juggling Commits #2",
|
||||
"",
|
||||
"*假如你还没有完成 Juggling Commits #1(前一关),这关不让玩哦!*",
|
||||
"",
|
||||
"如你在上一关所见,我们使用 `rebase -i` 来重排那些提交。只要把我们想要的提交挪到最顶端,我们就可以很容易地改变它,然后把它们重新排成我们想要的顺序。",
|
||||
"",
|
||||
"但唯一的问题就是这样做就要排很多次,有可能造成衍合冲突(rebase conflicts)。下面就看看用另外一种方法 `git cherry-pick` 是怎么做的吧。"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "GitDemonstrationView",
|
||||
"options": {
|
||||
"beforeMarkdowns": [
|
||||
"要在心理牢记 cherry-pick 可以从提交树的任何地方拿一个提交来放在 HEAD 上(尽管那个提交不在上游)。",
|
||||
"",
|
||||
"下面是一个小小的演示:"
|
||||
],
|
||||
"command": "git cherry-pick C2",
|
||||
"afterMarkdowns": [
|
||||
"好滴咧,我们继续"
|
||||
],
|
||||
"beforeCommand": "git checkout -b bugFix; git commit; git checkout master; git commit"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ModalAlert",
|
||||
"options": {
|
||||
"markdowns": [
|
||||
"那么这关呢,和上一关一样要改变提交 `C2`,但你要避免使用 `rebase -i`。自己想想要怎么解决吧,骚年! :D"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue