Added function to insert commit into pack

I added a helper function to add a commit, the tree it refers to and all of the subtrees and objects in that tree.