Skip to content
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

git-hash-object: add page #9060

Merged
merged 11 commits into from
Oct 19, 2022
20 changes: 20 additions & 0 deletions pages/common/git-hash-object.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# git hash-object

> Computes the unique hash key of content and optionally creates an object with specified type.
> More information: <https://git-scm.com/docs/git-hash-object>.

- Compute the object ID without storing it:

`git hash-object {{path/to/file}}`

- Compute the object ID and store it in the Git database:

`git hash-object -w {{path/to/file}}`

- Compute the object ID specifying the object type:

`git hash-object -t {{blob|commit|tag|tree}} {{path/to/file}}`

- Compute the object ID from stdin:

`cat {{path/to/file}} | git hash-object --stdin`