NAME

git-hash-object - Compute object ID and optionally creates a blob from a file

SYNOPSIS

  1. git hash-object [-t <type>] [-w] [--path=<file>|--no-filters] [--stdin [--literally]] [--] <file>…​
  2. git hash-object [-t <type>] [-w] --stdin-paths [--no-filters]

DESCRIPTION

Computes the object ID value for an object with specified typewith the contents of the named file (which can be outside of thework tree), and optionally writes the resulting object into theobject database. Reports its object ID to its standard output.When <type> is not specified, it defaults to "blob".

OPTIONS

  • -t
  • Specify the type (default: "blob").

  • -w

  • Actually write the object into the object database.

  • —stdin

  • Read the object from standard input instead of from a file.

  • —stdin-paths

  • Read file names from the standard input, one per line, insteadof from the command-line.

  • —path

  • Hash object as it were located at the given path. The location offile does not directly influence on the hash value, but path isused to determine what Git filters should be applied to the objectbefore it can be placed to the object database, and, as result ofapplying filters, the actual blob put into the object database maydiffer from the given file. This option is mainly useful for hashingtemporary files located outside of the working directory or filesread from stdin.

  • —no-filters

  • Hash the contents as is, ignoring any input filter that wouldhave been chosen by the attributes mechanism, including the end-of-lineconversion. If the file is read from standard input then thisis always implied, unless the —path option is given.

  • —literally

  • Allow —stdin to hash any garbage into a loose object which might nototherwise pass standard object parsing or git-fsck checks. Useful forstress-testing Git itself or reproducing characteristics of corrupt orbogus objects encountered in the wild.

GIT

Part of the git[1] suite