1

Is there a git operation that does the reverse of ls-tree?

What i want to do is to be able to find a file and it's path by searching through git with a specific file hash. This would essentially mean giving ls-tree a file hash and not a tree hash

example:

git ls-tree <tree-hash>
>040000 tree d3b424d952ddeecc16c6953e0757acfa1c19a6f9 sub_dir
>100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 test.py

now search for this tree with just the hash of test.py

git <some command> e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
>040000 tree d3b424d952ddeecc16c6953e0757acfa1c19a6f9 sub_dir
>100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 test.py
jh314
  • 27,144
  • 16
  • 62
  • 82
Rufman
  • 11
  • 1
  • 1
    You may try to write a script that walk through all objects in git repository and find the blob in every tree object. There is no efficient way for this request due to the way how git stores its data. – czchen Jun 25 '10 at 09:23
  • 3
    possible duplicate of [Git: Which commit has this blob?](http://stackoverflow.com/questions/223678/git-which-commit-has-this-blob) – Cascabel Jun 25 '10 at 13:50

0 Answers0