1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-22 10:22:08 +02:00
tldr/pages.zh/common/git-commit.md
Naiq ca11ff6026
git-*: add and update Chinese translations (#15940)
Co-authored-by: Managor <42655600+Managor@users.noreply.github.com>
2025-03-26 00:10:53 +02:00

32 lines
1,023 B
Markdown

# git commit
> 将文件提交到仓库。
> 更多信息:<https://git-scm.com/docs/git-commit>.
- 将暂存的文件提交到仓库,附带提交说明信息:
`git commit {{[-m|--message]}} "{{信息}}"`
- 提交暂存的文件,并从指定文件中读取附带的提交信息:
`git commit {{[-F|--file]}} {{路径/到/提交信息文件}}`
- 自动暂存并提交所有修改过的和删除的文件,附带提交信息:
`git commit {{[-a|--all]}} {{[-m|--message]}} "{{信息}}"`
- 提交暂存的文件,并使用指定的 GPG 密钥签名(若未指定参数则使用配置文件中的设定):
`git commit {{[-S|--gpg-sign]}} {{密钥ID}} {{[-m|--message]}} "{{信息}}"`
- 将当前暂存的更改追加到最近一次提交,并更新其哈希值:
`git commit --amend`
- 只提交指定的(已暂存的)文件:
`git commit {{路径/到/文件1 路径/到/文件2 ...}}`
- 即使没有暂存文件也创建提交:
`git commit {{[-m|--message]}} "{{信息}}" --allow-empty`