How to get the type and size of the git object using one single command?

Separately I can get type using git cat-file -t and size using git cat-file -s.

At the same type I can get type and size of all objects inside the tree just using git ls-tree -l.

But how can I properly get those for one single object using one single command?

  • Pull Request without Repository Access
  • Write Access for user on all repos on Gitolite
  • git.kernel.org mirror for linux kernel v2.6.35.y
  • Deploy a PHP project from Git to a server that does not have Git installed
  • Get topic branch from gerrit
  • How to get the removed branches in git
  • Git - Save Work in Progress — Changes Missing After Branching
  • git format-patch with a list file instead of numbered files
  • One Solution collect form web for “How to get the type and size of the git object using one single command?”

    There is probably no way of doing it on git, but you can do a little shell magic.

    git cat-file -t master ; git cat-file -s master will work but will output in two lines.

    If you want it on one line:

    (git cat-file -t master ; git cat-file -s master) | paste -sd " "

    Git Baby is a git and github fan, let's start git clone.