GIT-HASH-OBJECT(1)
π GIT-HASH-OBJECT(1) π
okay so this is the manual page for git-hash-object, bestie β it's living in the GIT-HASH-OBJECT(1) slot of your man pages and it's gonna teach you how to compute an object ID and, if you want, actually make an object out of a file. pull up a chair π
β¨ NAME β¨
git-hash-object β compute object ID and optionally create an object from a file
πΈ SYNOPSIS πΈ
git hash-object [-t <type>] [-w] [--path=<file> | --no-filters]
[--stdin [--literally]] [--] <file>...
git hash-object [-t <type>] [-w] --stdin-paths [--no-filters]
π¦ DESCRIPTION π¦
So what does this little icon actually do? It computes the object ID value for an object of a specified type, using the contents of the named file β and yes, that file can totally be chillin' outside of the work tree, no big deal. It can also optionally write the resulting object into the object database for you, which is the "make it real" option π
Then it reports its object ID to its standard output. That's the whole vibe β you get the hash, you go about your day.
Oh, and when <type> isn't specified? It defaults to "blob". periodt.
π OPTIONS π
-t <type>β specify the type of object to be created (default:"blob"). the possible values arecommit,tree,blob, andtag. pick your fighter π«Ά-wβ actually write the object into the object database. like, for real for real. no-w, no write, simple as that.--stdinβ read the object from standard input instead of from a file. feeding it through the pipe, main character energy π₯--stdin-pathsβ read file names from the standard input, one per line, instead of from the command-line. very "here's my list, don't @ me" of you.--pathβ hash object as if it were located at the given path. the location of the file does not directly influence the hash value, but the path is used to determine which Git filters should be applied to the object before it can be placed in the object database. and here's the plot twist: as a result of applying filters, the actual blob put into the object database may differ from the given file π this option is mainly useful for hashing temporary files located outside of the working directory, or files read from stdin.--no-filtersβ hash the contents as is, ignoring any input filter that would have been chosen by the attributes mechanism, including the end-of-line conversion. and heads up: if the file is read from standard input then this is always implied, unless the--pathoption is given. so don't come for it, it's just how it is π--literallyβ allow--stdinto hash any garbage into a loose object which might not otherwise pass standard object parsing or git-fsck checks. useful for stress-testing Git itself or reproducing characteristics of corrupt or bogus objects encountered in the wild. yes literally any garbage. chaos permitted, but read that again β it's for stress-testing Git and reproducing corrupt/bogus objects, not for your everyday hashing π
π GIT π
Part of the git(1) suite. you already knew that though, iykyk π
and that's the whole page, bestie β go forth and hash β¨
this was brought to you by Git 2.56.0, dated 2026-09-27. love that for us. ππ¦π
π¦ where this page comes from
- arch rolling: git 2.56.0-1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms