Move #history to Commit and add Commit#common_ancestor

The common_ancestor method will be used for finding a reference
commit when merging two branches.