Palestinians are returning to areas ruined by 15 months of war after Israel and Hamas resolved a dispute over hostages that threatened to derail the ceasefire.