commit:path/to/file
describes a file (a "BLOB") at a specific commit. For example in the git.git repository:
$ git rev-parse v2.31.1:git.c
9bc077a025cba4c5b3628b0eabb4d3aac0f35c63
$ git cat-file -t 9bc077a025cba4c5b3628b0eabb4d3aac0f35c63
blob
$ git cat-file -p 9bc077a025cba4c5b3628b0eabb4d3aac0f35c63 | head
#include "builtin.h"
#include "config.h"
#include "exec-cmd.h"
#include "help.h"
#include "run-command.h"
#include "alias.h"
#include "shallow.h"
#define RUN_SETUP (1<<0)
#define RUN_SETUP_GENTLY (1<<1)
You can find an explanation under the Specifying Revisions section of the rev-parse
man page:
<rev>:<path>, e.g. HEAD:README, master:./README
A suffix : followed by a path names the blob or tree at the given
path in the tree-ish object named by the part before the colon. A
path starting with ./ or ../ is relative to the current working
directory. The given path will be converted to be relative to the
working tree’s root directory. This is most useful to address a blob
or tree from a commit or tree that has the same tree structure as the
working tree.
Of course, path/to/file
might be a directory in which case the output hash will point to a tree object instead.