Amalek attacked Israel at Rephidim but Israel defeated Amalek. This was Israel’s first fighting since leaving Egypt.
At Rephidim, the Amalekites attacked Israel, but Israel won. GOD was angry with Amalek and swore to utterly destroy them.
8 Now Amalek came and fought with Israel in Rephidim. 9 So Moses said to Joshua, “Choose for yourself some mighty men and go out, and set the army in array against Amalek. Tomorrow I will stand on the top of the hill with the rod of God in my hand.” 10 So Joshua did as Moses said to him and set the army in array against Amalek. Then Moses, Aaron, and Hur went up to the top of the hill. 11 And so it was, when Moses held up his hands, that Israel prevailed; but when he let down his hands, Amalek prevailed. 12 Now Moses’ hands became heavy; so they took a stone and put it under him, and he sat on it. Then Aaron and Hur supported his hands, one on one side, and one on the other; and his hands were steady until the going down of the sun. 13 So Joshua defeated Amalek and his people with the edge of the sword.
14 Then the Lord said to Moses, “Write this for a memorial in a book and recount it in the hearing of Joshua, that I will utterly blot out the remembrance of Amalek from under heaven.” 15 Now Moses built an altar and called its name The-Lord-My-Refuge; 16 for with a secret hand the Lord wars with Amalek from generation to generation.Exodus 17:8-16 OSB
Amalek was the grandson of Esau, so the Amalekites were of the lineage of Abraham, as was Israel. This association contributed to the disdain GOD had towards the Amalekites’ attack.
Later, Moses reminded Israel about these events and instructed them to never forget what Amalek did:
17 “Remember what Amalek did to you on the way as you were coming out of Egypt, 18 how he met you on the way and cut off your rear guard, all the stragglers at your rear, when you were tired and weary; and he did not fear God. 19 Therefore it shall be, when the Lord your God gives you rest from your enemies all around in the land the Lord your God is giving you to possess as an inheritance, you will blot out the name of Amalek from under heaven. You shall not forget.Deuteronomy 25:17-19 OSB
The severity of Amalek’s actions here contributed, in a future time, to GOD’s rejection of Saul as king, because Saul failed to obey GOD that the Scripture might be fulfilled (see 1 Samuel 15). Amalek was eventually annihilated by David (see 1 Samuel 30).