The Israeli government has approved a ceasefire and hostage deal with the Palestinian militant group Hamas, leading to a possible end to 15 months of a devastating war in Gaza.