checkout to switch (zh-cn)

pull/630/head
booleans-oss 4 years ago
parent 397c45f0d4
commit 4765cb7c2a

@ -203,10 +203,10 @@
git branch [分支名]
```
1. **切换到工作分支**。使用 `git checkout` 来切换到指定分支并且更新工作目录中的文件:
1. **切换到工作分支**。使用 `git switch` 来切换到指定分支并且更新工作目录中的文件:
```bash
git checkout [分支名]
git switch [分支名]
```
1. **干活**。现在你可以添加你的变更了,别忘了用下面的命令告诉 Git 你所做的工作:
@ -221,14 +221,14 @@
1. **将你的工作合入 `main` 分支**。在完成工作后,你打算将你的工作和 `main` 分支上的合并。`main` 分支可能同时有了一些新的变更,所以要先用以下命令确保将其更新至最新版本:
```bash
git checkout main
git switch main
git pull
```
这时你想确认是否存在 _冲突conflicts_,即 Git 没法简单地将这些变化 _合入_ 你的分支的情况。为此运行下面的命令:
```bash
git checkout [分支名]
git switch [分支名]
git merge main
```

@ -209,11 +209,11 @@
"questionText": "你该如何切换到一个分支?",
"answerOptions": [
{
"answerText": "git switch [branch-name]",
"answerText": "git checkout [branch-name]",
"isCorrect": "false"
},
{
"answerText": "git checkout [branch-name]",
"answerText": "git switch [branch-name]",
"isCorrect": "true"
},
{

Loading…
Cancel
Save