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]
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 (default: "blob").
24
25 -w
26 Actually write the object into the object database.
27
28 --stdin
29 Read the object from standard input instead of from a file.
30
31 --stdin-paths
32 Read file names from the standard input, one per line, instead of
33 from the command-line.
34
35 --path
36 Hash object as it were located at the given path. The location of
37 file does not directly influence on the hash value, but path is
38 used to determine what Git filters should be applied to the object
39 before it can be placed to the object database, and, as result of
40 applying filters, the actual blob put into the object database may
41 differ from the given file. This option is mainly useful for
42 hashing temporary files located outside of the working directory or
43 files read from stdin.
44
45 --no-filters
46 Hash the contents as is, ignoring any input filter that would have
47 been chosen by the attributes mechanism, including the end-of-line
48 conversion. If the file is read from standard input then this is
49 always implied, unless the --path option is given.
50
51 --literally
52 Allow --stdin to hash any garbage into a loose object which might
53 not otherwise pass standard object parsing or git-fsck checks.
54 Useful for stress-testing Git itself or reproducing characteristics
55 of corrupt or bogus objects encountered in the wild.
56
58 Part of the git(1) suite
59
60
61
62Git 2.39.1 2023-01-13 GIT-HASH-OBJECT(1)