tldr/pages/common/git-cat-file.md

17 lines
424 B
Markdown
Raw Normal View History

2020-10-05 17:55:53 +03:00
# git cat-file
2021-01-07 17:06:38 +03:00
> Provide content or type and size information for Git repository objects.
2020-10-05 17:55:53 +03:00
> More information: <https://git-scm.com/docs/git-cat-file>.
- Get the [s]ize of the HEAD commit in bytes:
`git cat-file -s HEAD`
2021-01-07 17:06:38 +03:00
- Get the [t]ype (blob, tree, commit, tag) of a given Git object:
2020-10-05 17:55:53 +03:00
`git cat-file -t {{8c442dc3}}`
2021-01-07 17:06:38 +03:00
- Pretty-[p]rint the contents of a given Git object based on its type:
2020-10-05 17:55:53 +03:00
`git cat-file -p {{HEAD~2}}`