I would like to write a git tree into a directory, ie given that output from git ls-tree
:
% git ls-tree -lrt 312735a86fe300861ebf0e6b081616029c2f6b76
040000 tree ba37a4590a12acdd773e444b06e75ad151150ed2 - subdir1
100644 blob deba01fc8d98200761c46eb139f11ac244cf6eb5 10 subdir1/test.txt
100644 blob dce813842fd90177bd0fbfd3011797934ee31303 15 test2.txt
I want to do:
% git some-command 312735a86fe300861ebf0e6b081616029c2f6b76 /tmp/output-dir
And have in output-dir
:
tree output-dir
.
├── subdir1
│ └── test.txt
└── test2.txt
I imagine I could parse output of git ls-tree
and then, based on the second column call git ls-tree
recursively or git cat-file
. My question is more to know if there is a built-in tool (or an external tool) which allows to do just so?