Merge and restore deleted lines