I have a tree of commit found by SHA-1,code is: tree = repo.tree(sha) now I need to find blob by file name and display its content
Asked
Active
Viewed 120 times
1 Answers
1
given the SHA1 of the commit itself, you would:
git show SHA1:path/to/your/file.txt
if you know the sha1 of the blob itself, you can
git cat-file blob SHA1

user229044
- 232,980
- 40
- 330
- 338

Adam Dymitruk
- 124,556
- 26
- 146
- 141
-
thanks a lot, and do you know ho to do same in ruby ob rails? – Kazimír Nov 21 '11 at 19:57
-
I'm not sure about RoR, but check to see if the repo object has some methods that would allow you to get the blob contents by a SHA1 reference.. – Adam Dymitruk Nov 21 '11 at 19:59