WIP: Reflog support

This PR adds support for the reflog. Still WIP...