1GIT-HASH-OBJECT(1) Git Manual GIT-HASH-OBJECT(1)
2
3
4
6 git-hash-object - Compute object ID and optionally create an object
7 from a file
8
10 git hash-object [-t <type>] [-w] [--path=<file> | --no-filters]
11 [--stdin [--literally]] [--] <file>...
12 git hash-object [-t <type>] [-w] --stdin-paths [--no-filters]
13
15 Computes the object ID value for an object with specified type with the
16 contents of the named file (which can be outside of the work tree), and
17 optionally writes the resulting object into the object database.
18 Reports its object ID to its standard output. When <type> is not
19 specified, it defaults to "blob".
20
22 -t <type>
23 Specify the type of object to be created (default: "blob").
24 Possible values are commit, tree, blob, and tag.
25
26 -w
27 Actually write the object into the object database.
28
29 --stdin
30 Read the object from standard input instead of from a file.
31
32 --stdin-paths
33 Read file names from the standard input, one per line, instead of
34 from the command-line.
35
36 --path
37 Hash object as if it were located at the given path. The location
38 of the file does not directly influence the hash value, but the
39 path is used to determine which Git filters should be applied to
40 the object before it can be placed in the object database. As a
41 result of applying filters, the actual blob put into the object
42 database may differ from the given file. This option is mainly
43 useful for hashing temporary files located outside of the working
44 directory or files read from stdin.
45
46 --no-filters
47 Hash the contents as is, ignoring any input filter that would have
48 been chosen by the attributes mechanism, including the end-of-line
49 conversion. If the file is read from standard input then this is
50 always implied, unless the --path option is given.
51
52 --literally
53 Allow --stdin to hash any garbage into a loose object which might
54 not otherwise pass standard object parsing or git-fsck checks.
55 Useful for stress-testing Git itself or reproducing characteristics
56 of corrupt or bogus objects encountered in the wild.
57
59 Part of the git(1) suite
60
61
62
63Git 2.43.0 11/20/2023 GIT-HASH-OBJECT(1)