1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-22 01:02:09 +02:00

git-{alias, am, annex, annotate, apply, archive, archive-file, authors}: add Chinese translation (#16035)

This commit is contained in:
Ziqiang Wu 2025-04-12 15:48:07 +08:00 committed by GitHub
parent fefd284ea0
commit 5547815aff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 168 additions and 0 deletions

View file

@ -0,0 +1,17 @@
# git alias
> 为 Git 命令创建快捷方式。
> 属于 `git-extras`的一部分
> 更多信息:<https://github.com/tj/git-extras/blob/master/Commands.md#git-alias>.
- 列出所有别名
`git alias`
- 为命令创建一个别名
`git alias "{{别名}}" "{{命令}}"`
- 搜索一个现有的别名
`git alias ^{{别名}}`

21
pages.zh/common/git-am.md Normal file
View file

@ -0,0 +1,21 @@
# git am
> 应用补丁文件并创建提交。在通过电子邮件接收提交时非常有用。
> 另请参阅 `git format-patch`,该命令可以生成补丁文件。
> 更多信息:<https://git-scm.com/docs/git-am>.
- 应用本地补丁文件并提交更改:
`git am {{路径/到/目录.patch}}`
- 应用远程补丁文件并提交更改:
`curl {{[-L|--location]}} {{https://example.com/file.patch}} | git apply`
- 中止应用补丁文件的过程:
`git am --abort`
- 尽可能应用补丁文件,将失败的代码块保存到拒绝文件中:
`git am --reject {{路径/到/目录.patch}}`

View file

@ -0,0 +1,29 @@
# git annex
> 用 Git 管理文件,但不将其内容提交到版本库中。
> 当文件被附属时,其内容会被移至键值存储中,并创建一个指向该内容的符号链接。
> 更多信息:<https://git-annex.branchable.com>.
- 初始化一个带有 Git annex 的仓库:
`git annex init`
- 添加文件:
`git annex add {{路径/到/文件或目录}}`
- 显示文件或目录的当前状态:
`git annex status {{路径/到/文件或目录}}`
- 同步本地仓库与远程仓库:
`git annex {{远程仓库名}}`
- 获取文件或目录(从键值存储中恢复内容):
`git annex get {{路径/到/文件或目录}}`
- 显示帮助信息:
`git annex help`

View file

@ -0,0 +1,18 @@
# git annotate
> 显示文件中每一行的提交哈希值和最后修改作者。
> 参见 `git blame`(推荐优先使用该命令)
> 提供`git annotate` 主要是为了照顾熟悉其他版本控制系统的用户
> 更多信息:<https://git-scm.com/docs/git-annotate>.
- 打印文件内容,并在每行前附加作者姓名和提交哈希值:
`git annotate {{路径/到/文件}}`
- 打印文件内容,并在每行前附加作者邮箱和提交哈希值:
`git annotate {{[-e|--show-email]}} {{路径/到/文件}}`
- 仅打印匹配正则表达式的行:
`git annotate -L :{{正则表达式}} {{路径/到/文件}}`

View file

@ -0,0 +1,29 @@
# git apply
> 将补丁应用到文件和/或暂存区,但不创建提交。
> 另请参阅 `git am`,该命令不仅能应用补丁还会创建提交。
> 更多信息:<https://git-scm.com/docs/git-apply>.
- 显示补丁文件的应用详情:
`git apply --verbose {{路径/到/文件}}`
- 应用补丁并将修改添加到暂存区:
`git apply --index {{路径/到/文件}}`
- 应用远程补丁文件:
`curl -L {{https://example.com/file.patch}} | git apply`
- 应用远程补丁文件:
`git apply --stat --apply {{路径/到/文件}}`
- 反向应用补丁(撤销更改):
`git apply --reverse {{路径/到/文件}}`
- 将补丁结果存入暂存区但不修改工作区:
`git apply --cache {{路径/到/文件}}`

View file

@ -0,0 +1,9 @@
# git archive-file
> 将当前 Git 分支的所有文件导出为 Zip 压缩包。
> 属于 `git-extras`的一部分。
> 更多信息:<https://github.com/tj/git-extras/blob/master/Commands.md#git-archive-file>.
- 将当前检出的提交打包成 Zip 压缩包:
`git archive-file`

View file

@ -0,0 +1,28 @@
# git archive
> 从代码树创建文件归档。
> 更多信息:<https://git-scm.com/docs/git-archive>.
- 从当前 HEAD 内容创建 tar 归档并输出到标准输出:
`git archive {{[-v|--verbose]}} HEAD`
- 使用 Zip 格式并显示详细进度:
`git archive {{[-v|--verbose]}} --format zip HEAD`
- 将 Zip 归档输出到指定文件:
`git archive {{[-v|--verbose]}} {{[-o|--output]}} {{路径/到/文件.zip}} HEAD`
- 从指定分支的最新提交内容创建 tar 归档:
`git archive {{[-o|--output]}} {{路径/到/文件.tar}} {{指定分支}}`
- 使用特定目录的内容创建归档:
`git archive {{[-o|--output]}} {{路径/到/文件.tar}} HEAD:{{路径/到/目录}}`
- 为归档中的每个文件添加前缀路径:
`git archive {{[-o|--output]}} {{路径/到/文件.tar}} --prefix {{路径/到/前缀路径}}/ HEAD`

View file

@ -0,0 +1,17 @@
# git authors
> 生成 Git 仓库的提交者列表。
> 属于 `git-extras`的一部分。
> 更多信息:<https://github.com/tj/git-extras/blob/master/Commands.md#git-authors>.
- 将完整的提交者列表输出到标准输出,而不是写入到 `AUTHORS` 文件:
`git authors --list`
- 将提交者列表追加到 `AUTHORS` 文件并用默认编辑器打开:
`git authors`
- 将提交者列表(不包含邮箱)追加到 `AUTHORS` 文件并用默认编辑器打开:
`git authors --no-email`