Digging around Github's git database API
swanson.github.com
swanson.github.com
The API v3 object API is meant to be extremely low level. If you want to update a branch with a new commit, you'll have to:
* Create new blobs for the added/updated files.
* Create updated tree objects. This can get tedious. If you update a file in /a/b/c, there's at least 3 new tree objects that you'll need to update.
* Create a commit that points to the tree at /.
* Update the reference for that branch.
Whew! It's pretty clear we need some higher level API around viewing and updating files, like the Gist API.
Thanks for the feedback!
So what is the binary data that is base64 encoded? How does it get 'converted' to the raw output? I'll definitely be using the mime type, but I'm curious about how it's generated on the server.
You can do it this way, but the tree API will also take deep paths and recursively write all the subtrees for you and just return the new highest level tree SHA. You also technically don't need to write the blobs first to get the shas, the tree API can optionally take a tree.content field instead of the tree.sha field if you want it to write the blob and update the tree automatically for you.
As for examples, I'll do a blog post soon with some examples and we'll probably add a slightly higher level API more like what Gist has. For now learning the fairly straightforward object model and writing some client level abstraction shouldn't be too difficult.