What is the tree hash of a specific commit hash?

I need a shell command-line which puts the tree hash corresponding to a specific commit hash. I know that git cat-file commit $COMMITID | grep ^tree can do it, but I have to filter the output of that. Is there any command which prints only the hash?

  • Jenkins Git plugin detached HEAD
  • Command for adding all files in git status -uno
  • Pull requests overriding earlier commits
  • Un-ignore a specific bin directory
  • How do I add/upgrade/downgrade a remote Git project in my repository without using submodules?
  • Restricting users to a branch on GITHUB
  • How to get git parent branch name of current branch?
  • Find the branch of a commit on github
  • git conflict keep original upstream
  • bugfixing while developing with git
  • How can I combine these git commands?
  • How to rebase a series of branches?
  • 2 Solutions collect form web for “What is the tree hash of a specific commit hash?”

    git log -1 --pretty="%T" $COMMITID 
    
    git rev-parse $COMMITID^{tree}
    
    Git Baby is a git and github fan, let's start git clone.