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