Sort commits queried from the database by date