Merge remote and local histories and order by sequence