Cleanup formatting.
Fix parent merge detection.
Abstract out git checkout.