Skip to content

git-{checkout-index, cherry, cherry-pick}: add Chinese translation #16098

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions pages.zh/common/git-checkout-index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# git checkout-index

> 将文件从暂存区复制到工作区。
> 更多信息:<https://git-scm.com/docs/git-checkout-index>.

- 恢复自上次提交以来删除的所有文件:

`git checkout-index --all`

- 恢复自上次提交以来删除或修改的所有文件(强制覆盖):

`git checkout-index --all --force`

- 恢复自上次提交以来修改的文件(忽略已删除的文件):

`git checkout-index --all --force --no-create`

- 将最后一次提交的整个工作树导出到指定目录(注意结尾斜杠):

`git checkout-index --all --force --prefix={{路径/到/导出目录/}}`
21 changes: 21 additions & 0 deletions pages.zh/common/git-cherry-pick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# git cherry-pick

> 将现有提交的变更应用到当前分支。
> 如需应用到其他分支,请先用 `git checkout` 切换到目标分支。
> 更多信息:<https://git-scm.com/docs/git-cherry-pick>.

- 将单个提交应用到当前分支:

`git cherry-pick {{提交哈希}}`

- 将连续多个提交应用到当前分支(也可参考 `git rebase --onto`):

`git cherry-pick {{起始提交}}~..{{结束提交}}`

- 将多个(非连续的)提交应用到当前分支:

`git cherry-pick {{提交1 提交2 ...}}`

- 将提交变更应用到工作区但不自动创建提交:

`git cherry-pick --no-commit {{提交哈希}}`
16 changes: 16 additions & 0 deletions pages.zh/common/git-cherry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# git cherry

> 查找尚未应用到上游分支的提交。
> 更多信息:<https://git-scm.com/docs/git-cherry>.

- 显示已在上游分支有对应提交的提交(包含提交信息):

`git cherry {{[-v|--verbose]}}`

- 指定不同的上游分支和主题分支进行比较:

`git cherry {{上游分支}} {{主题分支}}`

- 限定比较范围到某个基准点之后的提交:

`git cherry {{上游分支}} {{主题分支}} {{基准点}}`