Fix tree sort to match real git
Clean up
Do best effort to match hash, but force if not possible