Senica Gonzalez
Senica Gonzalez

Reputation: 8182

Git - Get file blob by tree location not by sha

I'm trying to use GitHub's API to retrieve the blob of a file. I know I could start at the master and run through the entire tree, grabbing commit SHA's, until I make a match to the path I want, but that seems like so many queries and so much overhead.

Is it possible to pass in something to git like "master/folder/file.txt" and get the blob information in one query?

I just want to display the most recent version of the file in the master branch.

This is what I'm looking at: http://developer.github.com/v3/git/ I just don't know where I should be looking. I'm running through the book now trying to find something.

Upvotes: 1

Views: 325

Answers (1)

Senica Gonzalez
Senica Gonzalez

Reputation: 8182

It's very simple when using Github I found out.

You just need to query the raw.github.com instead of api.github.com

https://raw.github.com/senica/Booger/master/admin/admin.php

Upvotes: 2

Related Questions