Files
tldr/pages.zh/common/git-hash-object.md

20 lines
524 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# git hash-object
> 计算内容的唯一哈希键,并可选择创建具有指定类型的对象。
> 更多信息:<https://git-scm.com/docs/git-hash-object>。
- 计算对象 ID 而不存储它:
`git hash-object {{path/to/file}}`
- 计算对象 ID 并将其存储在 Git 数据库中:
`git hash-object -w {{path/to/file}}`
- 指定对象类型计算对象 ID
`git hash-object -t {{blob|commit|tag|tree}} {{path/to/file}}`
-`stdin` 计算对象 ID
`cat {{path/to/file}} | git hash-object --stdin`