From 3cf57d14e01dcb9809ba9c104254c3b671e351ef Mon Sep 17 00:00:00 2001 From: Guangwen Feng Date: Sat, 16 Jul 2022 16:17:40 +0800 Subject: [PATCH] [zh-cn] Update open-a-pr.md Signed-off-by: Guangwen Feng --- .../docs/contribute/new-content/open-a-pr.md | 816 +++++++++--------- 1 file changed, 423 insertions(+), 393 deletions(-) diff --git a/content/zh-cn/docs/contribute/new-content/open-a-pr.md b/content/zh-cn/docs/contribute/new-content/open-a-pr.md index a0dd88e8e1..1e2dc956c1 100644 --- a/content/zh-cn/docs/contribute/new-content/open-a-pr.md +++ b/content/zh-cn/docs/contribute/new-content/open-a-pr.md @@ -23,7 +23,9 @@ upcoming Kubernetes release, see [Document a new feature](/docs/contribute/new-content/new-features/). {{< /note >}} -To contribute new content pages or improve existing content pages, open a pull request (PR). Make sure you follow all the requirements in the [Before you begin](/docs/contribute/new-content/overview/#before-you-begin) section. +To contribute new content pages or improve existing content pages, open a pull request (PR). +Make sure you follow all the requirements in the +[Before you begin](/docs/contribute/new-content/) section. --> {{< note >}} **代码开发者们**:如果你在为下一个 Kubernetes 发行版本中的某功能特性撰写文档, @@ -31,14 +33,14 @@ To contribute new content pages or improve existing content pages, open a pull r {{< /note >}} 要贡献新的内容页面或者改进已有内容页面,请发起拉取请求(PR)。 -请确保你满足了[开始之前](/zh-cn/docs/contribute/new-content/#before-you-begin)一节中所列举的所有要求。 +请确保你满足了[开始之前](/zh-cn/docs/contribute/new-content/)一节中所列举的所有要求。 如果你所提交的变更足够小,或者你对 git 工具不熟悉,可以阅读 [使用 GitHub 提交变更](#changes-using-github)以了解如何编辑页面。 @@ -52,12 +54,12 @@ learn how to make changes locally on your computer. ## Changes using GitHub If you're less experienced with git workflows, here's an easier method of -opening a pull request. The figure below outlines the steps and the details follow. +opening a pull request. Figure 1 outlines the steps and the details follow. --> -## 使用 GitHub 提交变更 {#changes-using-github} +## 使用 GitHub 提交变更 {#changes-using-github} 如果你在 git 工作流方面欠缺经验,这里有一种发起拉取请求的更为简单的方法。 -下图勾勒了后续的步骤和细节。 +图 1 勾勒了后续的步骤和细节。 @@ -90,67 +92,75 @@ class tasks,tasks2 white class id1 k8s {{}} -***插图 - 使用 GitHub 发起一个 PR 的步骤*** + +图 1. 使用 GitHub 发起一个 PR 的步骤。 +1. On the page where you see the issue, select the pencil icon at the top right. + You can also scroll to the bottom of the page and select **Edit this page**. +1. Make your changes in the GitHub markdown editor. + +1. Below the editor, fill in the **Propose file change** form. + In the first field, give your commit message a title. + In the second field, provide a description. +--> 1. 在你发现问题的网页,选择右上角的铅笔图标。 你也可以滚动到页面底端,选择**编辑此页**。 + 2. 在 GitHub 的 Markdown 编辑器中修改内容。 + 3. 在编辑器的下方,填写 **Propose file change** 表单。 在第一个字段中,为你的提交消息取一个标题。 在第二个字段中,为你的提交写一些描述文字。 - + + {{< note >}} 不要在提交消息中使用 [GitHub 关键词](https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword)。 你可以在后续的 PR 描述中使用这些关键词。 {{< /note >}} + 4. 选择 **Propose File Change**。 + 5. 选择 **Create pull request**。 + 6. 出现 **Open a pull request** 界面。填写表单: - - **Subject** 字段默认为提交的概要信息。你可以根据需要修改它。 - - **Body** 字段包含更为详细的提交消息,如果你之前有填写过的话, - 以及一些模板文字。填写模板所要求的详细信息, - 之后删除多余的模板文字。 - - 确保 **Allow edits from maintainers** 复选框被勾选。 + - **Subject** 字段默认为提交的概要信息。你可以根据需要修改它。 + - **Body** 字段包含更为详细的提交消息,如果你之前有填写过的话, + 以及一些模板文字。填写模板所要求的详细信息, + 之后删除多余的模板文字。 + - 确保 **Allow edits from maintainers** 复选框被勾选。 {{< note >}} PR 描述信息是帮助 PR 评阅人了解你所提议的变更的重要途径。 更多信息请参考[发起一个 PR](#open-a-pr)。 {{< /note >}} - + 7. 选择 **Create pull request**。 -### 在 GitHub 上处理反馈意见 +### 在 GitHub 上处理反馈意见 {#addressing-feedback-in-github} 在合并 PR 之前,Kubernetes 社区成员会评阅并批准它。 `k8s-ci-robot` 会基于页面中最近提及的属主来建议评阅人(reviewers)。 @@ -171,12 +181,12 @@ leave a comment with their GitHub username in it. If a reviewer asks you to make changes: 1. Go to the **Files changed** tab. -2. Select the pencil (edit) icon on any files changed by the -pull request. -3. Make the changes requested. -4. Commit the changes. +1. Select the pencil (edit) icon on any files changed by the pull request. +1. Make the changes requested. +1. Commit the changes. -If you are waiting on a reviewer, reach out once every 7 days. You can also post a message in the `#sig-docs` Slack channel. +If you are waiting on a reviewer, reach out once every 7 days. You can also post a message in the +`#sig-docs` Slack channel. When your review is complete, a reviewer merges your PR and your changes go live a few minutes later. --> @@ -199,11 +209,12 @@ When your review is complete, a reviewer merges your PR and your changes go live If you're more experienced with git, or if your changes are larger than a few lines, work from a local fork. -Make sure you have [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) installed on your computer. You can also use a git UI application. +Make sure you have [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) installed +on your computer. You can also use a git UI application. -The figure below shows the steps to follow when you work from a local fork. The details for each step follow. +Figure 2 shows the steps to follow when you work from a local fork. The details for each step follow. --> -## 基于本地克隆副本开展工作 {#work-from-a-local-fork} +## 基于本地克隆副本开展工作 {#fork-the-repo} 如果你有 git 的使用经验,或者你要提议的修改不仅仅几行,请使用本地克隆副本 来开展工作。 @@ -211,7 +222,7 @@ The figure below shows the steps to follow when you work from a local fork. The 首先要确保你在本地计算机上安装了 [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)。 你也可以使用 git 的带用户界面的应用。 -下图显示了基于本地克隆副本开展工作的步骤。 +图 2 显示了基于本地克隆副本开展工作的步骤。 每个步骤的细节如下。 @@ -243,88 +254,90 @@ class changes,changes2 white {{}} -***插图 - 使用本地克隆副本进行修改*** +图 2. 使用本地克隆副本进行修改。 -### 派生 kubernetes/website 仓库 +### 派生 kubernetes/website 仓库 {#fork-the-kubernetes-website-repository} 1. 前往 [`kubernetes/website`](https://github.com/kubernetes/website/) 仓库; -2. 选择 **Fork**. +1. 选择 **Fork**. -### 创建一个本地克隆副本并指定 upstream 仓库 +### 创建一个本地克隆副本并指定 upstream 仓库 {#create-a-local-clone-and-set-the-upstream} -3. 打开终端窗口,克隆你所派生的副本,并更新 [Docsy Hugo 主题](https://github.com/google/docsy#readme): +1. 打开终端窗口,克隆你所派生的副本,并更新 [Docsy Hugo 主题](https://github.com/google/docsy#readme): - ```bash - git clone git@github.com//website - cd website - git submodule update --init --recursive --depth 1 - ``` + ```shell + git clone git@github.com//website + cd website + git submodule update --init --recursive --depth 1 + ``` -4. 前往新的 `website` 目录,将 `kubernetes/website` 仓库设置为 `upstream` +2. 前往新的 `website` 目录,将 `kubernetes/website` 仓库设置为 `upstream` 远端: - ```bash - cd website - git remote add upstream https://github.com/kubernetes/website.git - ``` + ```shell + cd website + + git remote add upstream https://github.com/kubernetes/website.git + ``` -5. 确认你现在有两个仓库,`origin` 和 `upstream`: +3. 确认你现在有两个仓库,`origin` 和 `upstream`: - ```bash - git remote -v - ``` + ```shell + git remote -v + ``` - - 输出类似于: + Output is similar to: - ```bash - origin git@github.com:/website.git (fetch) - origin git@github.com:/website.git (push) - upstream https://github.com/kubernetes/website.git (fetch) - upstream https://github.com/kubernetes/website.git (push) - ``` + ```none + origin git@github.com:/website.git (fetch) + origin git@github.com:/website.git (push) + upstream https://github.com/kubernetes/website.git (fetch) + upstream https://github.com/kubernetes/website.git (push) + ``` -6. 从你的克隆副本取回 `origin/master` 分支,从 `kubernetes/website` 取回 `upstream/main`: +4. 从你的克隆副本取回 `origin/main` 分支,从 `kubernetes/website` 取回 `upstream/main`: + + ```shell + git fetch origin + git fetch upstream + ``` - ```bash - git fetch origin - git fetch upstream - ``` 这样可以确保你本地的仓库在开始工作前是最新的。 - {{< note >}} - 此工作流程与 [Kubernetes 社区 GitHub 工作流](https://github.com/kubernetes/community/blob/master/contributors/guide/github-workflow.md)有所不同。 - 在推送你的变更到你的远程派生副本库之前,你不需要将你本地的 `main` 与 `upstream/main` 合并。 - {{< /note >}} + {{< note >}} + 此工作流程与 [Kubernetes 社区 GitHub 工作流](https://github.com/kubernetes/community/blob/master/contributors/guide/github-workflow.md)有所不同。 + 在推送你的变更到你的远程派生副本库之前,你不需要将你本地的 `main` 与 `upstream/main` 合并。 + {{< /note >}} -### 创建一个分支 +### 创建一个分支 {#create-a-branch} 1. 决定你要基于哪个分支来开展工作: @@ -357,24 +371,24 @@ class changes,changes2 white 如果你在选择分支上需要帮助,请在 `#sig-docs` Slack 频道提问。 2. 基于第 1 步中选定的分支,创建新分支。 下面的例子假定基础分支是 `upstream/main`: - ```bash - git checkout -b upstream/main - ``` - + ```shell + git checkout -b upstream/main + ``` + 3. 使用文本编辑器进行修改。 - 在任何时候,都可以使用 `git status` 命令查看你所改变了的文件列表。 -### 提交你的变更 +### 提交你的变更 {#commit-your-changes} 当你准备好发起拉取请求(PR)时,提交你所做的变更。 1. 在你的本地仓库中,检查你要提交的文件: - ```bash - git status - ``` + ```shell + git status + ``` - 输出类似于: + + 输出类似于: - ```bash - On branch - Your branch is up to date with 'origin/'. + ```none + On branch + Your branch is up to date with 'origin/'. - Changes not staged for commit: - (use "git add ..." to update what will be committed) - (use "git checkout -- ..." to discard changes in working directory) + Changes not staged for commit: + (use "git add ..." to update what will be committed) + (use "git checkout -- ..." to discard changes in working directory) - modified: content/en/docs/contribute/new-content/contributing-content.md + modified: content/en/docs/contribute/new-content/contributing-content.md - no changes added to commit (use "git add" and/or "git commit -a") - ``` + no changes added to commit (use "git add" and/or "git commit -a") + ``` 2. 将 **Changes not staged for commit** 下列举的文件添加到提交中: - ```bash - git add - ``` + ```shell + git add + ``` + + + 针对每个文件重复此操作。 - 针对每个文件重复此操作。 3. 添加完所有文件之后,创建一个提交(commit): - ```bash - git commit -m "Your commit message" - ``` + ```shell + git commit -m "Your commit message" + ``` + + + {{< note >}} + 不要在提交消息中使用任何 [GitHub 关键词](https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword)。 + 你可以在后续的 PR 描述中使用这些关键词。 + {{< /note >}} - {{< note >}} - 不要在提交消息中使用任何 [GitHub 关键词](https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword)。 - 你可以在后续的 PR 描述中使用这些关键词。 - {{< /note >}} 4. 推送你本地分支及其中的新提交到你的远程派生副本库: - ```bash - git push origin - ``` + ```shell + git push origin + ``` -### 在本地预览你的变更 {#preview-locally} +### 在本地预览你的变更 {#preview-locally} 在推送变更或者发起 PR 之前在本地查看一下预览是个不错的主意。 通过预览你可以发现构建错误或者 Markdown 格式问题。 @@ -500,9 +492,8 @@ You can either build the website's container image or run Hugo locally. Building {{% tab name="在容器内执行 Hugo" %}} {{< note >}} 下面的命令中使用 Docker 作为默认的容器引擎。 @@ -510,39 +501,33 @@ The commands below use Docker as default container engine. Set the `CONTAINER_EN {{< /note >}} -1. 在本地构建镜像: +1. 在本地构建容器镜像 + _如果你正在测试对 Hugo 工具本身的更改,则仅需要此步骤_ - ```bash - # 使用 docker (默认) - make container-image - - ### 或 ### - - # 使用 podman - CONTAINER_ENGINE=podman make container-image - ``` + ```shell + # 在终端窗口中执行(如果有需要) + make container-image + ``` -2. 在本地构建了 `kubernetes-hugo` 镜像之后,可以构建并启动网站: +2. 在容器中启动 Hugo: - ```bash - # 使用 docker (默认) - make container-serve + ```shell + # 在终端窗口中执行 + make container-serve + ``` - ### 或 ### - - # 使用 podman - CONTAINER_ENGINE=podman make container-serve - ``` 3. 启动浏览器,浏览 `https://localhost:1313`。 Hugo 会监测文件的变更并根据需要重新构建网站。 @@ -558,10 +543,11 @@ Alternately, install and use the `hugo` command on your computer: 另一种方式是,在你的本地计算机上安装并使用 `hugo` 命令: 1. 安装 [`website/netlify.toml`](https://raw.githubusercontent.com/kubernetes/website/main/netlify.toml) 文件中指定的 [Hugo](https://gohugo.io/getting-started/installing/) 版本。 @@ -570,24 +556,30 @@ Alternately, install and use the `hugo` command on your computer: 如果本地缺少主题的副本,则该站点无法构建。 要更新网站主题,运行以下命令: - ```bash - git submodule update --init --recursive --depth 1 - ``` + ```shell + git submodule update --init --recursive --depth 1 + ``` + 3. 启动一个终端窗口,进入 Kubernetes 网站仓库目录,启动 Hugo 服务器: - ```bash - cd /website - hugo server - ``` + ```shell + cd /website + hugo server --buildFuture + ``` + 4. 在浏览器的地址栏输入: `https://localhost:1313`。 Hugo 会监测文件的变更并根据需要重新构建网站。 + 5. 要停止本地 Hugo 实例,返回到终端窗口并输入 `Ctrl+C` 或者关闭终端窗口。 {{% /tab %}} @@ -596,12 +588,12 @@ Alternately, install and use the `hugo` command on your computer: -### 从你的克隆副本向 kubernetes/website 发起拉取请求(PR) {#open-a-pr} +### 从你的克隆副本向 kubernetes/website 发起拉取请求(PR) {#open-a-pr} -下图显示了从你的克隆副本向 K8s/website 发起 PR 的步骤。 +图 3 显示了从你的克隆副本向 K8s/website 发起 PR 的步骤。 详细信息如下。 @@ -629,58 +621,71 @@ classDef white fill:#ffffff,stroke:#000,stroke-width:px,color:#000,font-weight:b class 1,2,3,4,5,6,7,8 grey class first,second white {{}} + -***插图 - 从你的克隆副本向 K8s/website 发起一个 PR 的步骤*** +图 3. 从你的克隆副本向 K8s/website 发起一个 PR 的步骤。 1. 在 Web 浏览器中,前往 [`kubernetes/website`](https://github.com/kubernetes/website/) 仓库; -2. 点击 **New Pull Request**; -3. 选择 **compare across forks**; -4. 从 **head repository** 下拉菜单中,选取你的派生仓库; -5. 从 **compare** 下拉菜单中,选择你的分支; -6. 点击 **Create Pull Request**; -7. 为你的拉取请求添加一个描述: +1. 点击 **New Pull Request**; +1. 选择 **compare across forks**; +1. 从 **head repository** 下拉菜单中,选取你的派生仓库; +1. 从 **compare** 下拉菜单中,选择你的分支; +1. 点击 **Create Pull Request**; +1. 为你的拉取请求添加一个描述: + - **Title** (不超过 50 个字符):总结变更的目的; - **Description**:给出变更的详细信息; + - 如果存在一个相关联的 GitHub Issue,可以在描述中包含 `Fixes #12345` 或 `Closes #12345`。GitHub 的自动化设施能够在当前 PR 被合并时自动关闭所提及 的 Issue。如果有其他相关联的 PR,也可以添加对它们的链接。 - 如果你特别希望获得某方面的建议,可以在描述中包含你希望评阅人思考的问题。 -8. 点击 **Create pull request** 按钮。 - 祝贺你!你的拉取请求现在出现在 [Pull Requests](https://github.com/kubernetes/website/pulls) 列表中了! +1. 点击 **Create pull request** 按钮。 + +祝贺你!你的拉取请求现在出现在 [Pull Requests](https://github.com/kubernetes/website/pulls) 列表中了! 在发起 PR 之后,GitHub 会执行一些自动化的测试,并尝试使用 [Netlify](https://www.netlify.com/) 部署一个预览版本。 - - 如果 Netlify 构建操作失败,可选择 **Details** 了解详细信息。 - - 如果 Netlify 构建操作成功,选择 **Details** 会打开 Kubernetes 的一个预览 - 版本,其中包含了你所作的变更。评阅人也使用这一功能来检查你的变更。 +- 如果 Netlify 构建操作失败,可选择 **Details** 了解详细信息。 +- 如果 Netlify 构建操作成功,选择 **Details** 会打开 Kubernetes 的一个预览版本, + 其中包含了你所作的变更。评阅人也使用这一功能来检查你的变更。 GitHub 也会自动为 PR 分派一些标签,以帮助评阅人。 如果有需要,你也可以向 PR 添加标签。 @@ -692,32 +697,33 @@ GitHub 也会自动为 PR 分派一些标签,以帮助评阅人。 1. After making your changes, amend your previous commit: --> -### 在本地处理反馈 +### 在本地处理反馈 {#addressing-feedback-locally} 1. 在本地完成修改之后,可以修补(amend)你之前的提交: - ```bash - git commit -a --amend - ``` + ```shell + git commit -a --amend + ``` - - - `-a`:提交所有修改 - - `--amend`:对前一次提交进行增补,而不是创建新的提交 + + - `-a`:提交所有修改 + - `--amend`:对前一次提交进行增补,而不是创建新的提交 2. 如果有必要,更新你的提交消息; + 3. 使用 `git push origin ` 来推送你的变更,重新触发 Netlify 测试。 {{< note >}} 如果你使用 `git commit -m` 而不是增补参数,在 PR 最终合并之前你必须 @@ -731,43 +737,45 @@ Sometimes reviewers commit to your pull request. Before making any other changes 1. Fetch commits from your remote fork and rebase your working branch: --> -#### 来自评阅人的修改 +#### 来自评阅人的修改 {#changes-from-reviewers} 有时评阅人会向你的 PR 中提交修改。在作出其他修改之前,请先取回这些提交。 1. 从你的远程派生副本仓库取回提交,让你的工作分支基于所取回的分支: - ```bash - git fetch origin - git rebase origin/ - ``` + ```shell + git fetch origin + git rebase origin/ + ``` + 2. 变更基线(rebase)操作完成之后,强制推送本地的新改动到你的派生仓库: - ```bash - git push --force-with-lease origin - ``` + ```shell + git push --force-with-lease origin + ``` -#### 合并冲突和重设基线 +#### 合并冲突和重设基线 {#merge-conflicts-and-rebasing} {{< note >}} 要了解更多信息,可参考 -[Git 分支管理 - 基本分支和合并](https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging#_basic_merge_conflicts)、 -[高级合并](https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging), +[Git Branching - Basic Branching and Merging](https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging#_basic_merge_conflicts)、 +[Advanced Merging](https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging), 或者在 `#sig-docs` Slack 频道寻求帮助。 {{< /note >}} @@ -776,99 +784,108 @@ If another contributor commits changes to the same file in another PR, it can cr 1. 更新你的派生副本,重设本地分支的基线: - ```bash + ```shell git fetch origin git rebase origin/ ``` - + 之后强制推送修改到你的派生副本仓库: - ```bash + ```shell git push --force-with-lease origin ``` + 2. 从 `kubernetes/website` 的 `upstream/main` 分支取回更改,然后重设本地分支的基线: - ```bash + ```shell git fetch upstream git rebase upstream/main ``` + 3. 检查重设基线操作之后的状态: - ```bash + ```shell git status ``` - + 你会看到一组存在冲突的文件。 4. 打开每个存在冲突的文件,查找冲突标记:`>>>`、`<<<` 和 `===`。 解决完冲突之后删除冲突标记。 - - {{< note >}} - 进一步的详细信息可参见 - [冲突是怎样表示的](https://git-scm.com/docs/git-merge#_how_conflicts_are_presented). - {{< /note >}} + + {{< note >}} + 进一步的详细信息可参见 + [冲突是怎样表示的](https://git-scm.com/docs/git-merge#_how_conflicts_are_presented). + {{< /note >}} 5. 添加文件到变更集合: - ```bash - git add - ``` + ```shell + git add + ``` + 6. 继续执行基线变更(rebase)操作: - ```bash - git rebase --continue - ``` + ```shell + git rebase --continue + ``` 7. 根据需要重复步骤 2 到 5。 在应用完所有提交之后,`git status` 命令会显示 rebase 操作完成。 8. 将分支强制推送到你的派生仓库: - ```bash - git push --force-with-lease origin - ``` + ```shell + git push --force-with-lease origin + ``` - - PR 不再显示存在冲突。 + + PR 不再显示存在冲突。 -### 压缩(Squashing)提交 {#squashing-commits} +### 压缩(Squashing)提交 {#squashing-commits} {{< note >}} 要了解更多信息,可参看 @@ -877,13 +894,17 @@ For more information, see [Git Tools - Rewriting History](https://git-scm.com/bo {{< /note >}} 如果你的 PR 包含多个提交(commits),你必须将其压缩成一个提交才能被合并。 你可以在 PR 的 **Commits** Tab 页面查看提交个数,也可以在本地通过 `git log` 命令查看提交个数。 - + {{< note >}} 本主题假定使用 `vim` 作为命令行文本编辑器。 {{< /note >}} @@ -893,103 +914,113 @@ If your PR has multiple commits, you must squash them into a single commit befor --> 1. 启动一个交互式的 rebase 操作: - ```bash - git rebase -i HEAD~ - ``` + ```shell + git rebase -i HEAD~ + ``` - - 压缩提交的过程也是一种重设基线的过程。 - 这里的 `-i` 开关告诉 git 你希望交互式地执行重设基线操作。 - `HEAD~ + 压缩提交的过程也是一种重设基线的过程。 + 这里的 `-i` 开关告诉 git 你希望交互式地执行重设基线操作。 + `HEAD~ - 输出类似于; + + 输出类似于; - ```bash - pick d875112ca Original commit - pick 4fa167b80 Address feedback 1 - pick 7d54e15ee Address feedback 2 + ```none + pick d875112ca Original commit + pick 4fa167b80 Address feedback 1 + pick 7d54e15ee Address feedback 2 - # Rebase 3d18sf680..7d54e15ee onto 3d183f680 (3 commands) + # Rebase 3d18sf680..7d54e15ee onto 3d183f680 (3 commands) - ... + ... - # These lines can be re-ordered; they are executed from top to bottom. - ``` + # These lines can be re-ordered; they are executed from top to bottom. + ``` - - 输出的第一部分列举了重设基线操作中的提交。 - 第二部分给出每个提交的选项。 - 改变单词 `pick` 就可以改变重设基线操作之后提交的状态。 + For the purposes of rebasing, focus on `squash` and `pick`. + --> + 输出的第一部分列举了重设基线操作中的提交。 + 第二部分给出每个提交的选项。 + 改变单词 `pick` 就可以改变重设基线操作之后提交的状态。 - 就重设基线操作本身,我们关注 `squash` 和 `pick` 选项。 + 就重设基线操作本身,我们关注 `squash` 和 `pick` 选项。 - - {{< note >}} - 进一步的详细信息可参考 [Interactive Mode](https://git-scm.com/docs/git-rebase#_interactive_mode)。 - {{< /note >}} + + {{< note >}} + 进一步的详细信息可参考 [Interactive Mode](https://git-scm.com/docs/git-rebase#_interactive_mode)。 + {{< /note >}} 2. 开始编辑文件。 - 修改原来的文本: + 修改原来的文本: - ```bash - pick d875112ca Original commit - pick 4fa167b80 Address feedback 1 - pick 7d54e15ee Address feedback 2 - ``` + ```none + pick d875112ca Original commit + pick 4fa167b80 Address feedback 1 + pick 7d54e15ee Address feedback 2 + ``` - - 使之成为: + + 使之成为: - ```bash - pick d875112ca Original commit - squash 4fa167b80 Address feedback 1 - squash 7d54e15ee Address feedback 2 - ``` + ```none + pick d875112ca Original commit + squash 4fa167b80 Address feedback 1 + squash 7d54e15ee Address feedback 2 + ``` - - 以上编辑操作会压缩提交 `4fa167b80 Address feedback 1` 和 `7d54e15ee Address feedback 2` - 到 `d875112ca Original commit` 中,只留下 `d875112ca Original commit` 成为时间线中的一部分。 + + 以上编辑操作会压缩提交 `4fa167b80 Address feedback 1` 和 `7d54e15ee Address feedback 2` + 到 `d875112ca Original commit` 中,只留下 `d875112ca Original commit` 成为时间线中的一部分。 3. 保存文件并退出编辑器。 4. 推送压缩后的提交: - ```bash - git push --force-with-lease origin - ``` + ```shell + git push --force-with-lease origin + ``` -## 贡献到其他仓库 +## 贡献到其他仓库 {#contribute-to-other-repos} [Kubernetes 项目](https://github.com/kubernetes)包含大约 50 多个仓库。 这些仓库中很多都有文档:提供给最终用户的帮助文本、错误信息、API 参考或者代码注释等。 @@ -998,13 +1029,12 @@ This can help you figure out where to submit your issue or PR. 这样有助于发现要在哪里提交 Issue 或 PR。 每个仓库有其自己的流程和过程。在登记 Issue 或者发起 PR 之前, 记得阅读仓库可能存在的 `README.md`、`CONTRIBUTING.md` 和 @@ -1018,7 +1048,7 @@ the templates with as much detail as possible when you file issues or PRs. ## {{% heading "whatsnext" %}} - 阅读[评阅](/zh-cn/docs/contribute/review/reviewing-prs)节,学习评阅过程。