Improve memory management and the interface of Commit

Current version of Commit is NOT compatible with GitRepository