I have written some scripts for code analysis needs via git/grep/awk/ruby. code metrics, top committers, frequently committed files, duplications etc
you can find some interesting question with solutions http://stackoverflow.com/questions/tagged/git?sort=votes&...
if you need low level access https://github.com/mojombo/grit
could you elaborate, what your expectations are, I can give pointers or share some of my code