git cat-file
A low-level command that prints a Git object's type (-t), size (-s) or contents (-p) given its ID or another revision.
In more detail
git cat-file -p HEAD prints the current commit's text: tree, parent, author, committer and message. It is how you prove what Git actually stores rather than trusting a summary. --batch-all-objects with --batch-check lists every object in the repository.
Examples
git cat-file -t HEADgit cat-file -p :notes.txtRelated terms
- Git object — One item in Git's database, a blob, tree, commit or annotated tag, stored under the hash of its content.
- git hash-object — A low-level command that prints the object ID Git would give some content, and can store it with -w.
- revision — Any expression Git accepts as a name for a commit or other object, such as an ID, a branch name, a tag, HEAD or HEAD~2.
Taught in
- What A Commit Really Is — Advanced Git Internals & Distributed Workflows
- The Three Areas: Working Tree, Index, Repository — Advanced Git Internals & Distributed Workflows
- Merging: Fast Forward Or A Merge Commit — Advanced Git Internals & Distributed Workflows
- Rebase: The Same Work, A Different History — Advanced Git Internals & Distributed Workflows