The whole congregation of the sons of Israel journeyed from the wilderness of Sin to Rephidim. They did this because the Lord commanded the move and he orchestrated the move in stages. Later writings will reveal how the sons of Israel would move from one location to another in stages. There was no water at Rephidim and the people were thirsty. They had no means to lash out at the Lord, so they chose his human representative. Moses believed that the people were ready to stone him; therefore, he called out to the Lord for help. The Lord told Moses to pass before the people (this was so that they would see what was going on) and bring with him some of the elders. Moses was to take in his hand the staff with which he struck the Nile. Moses was to meet the Lord at Horeb.
“Horeb (“desert”), a range of mountains on the Sinai Peninsula, of which Mount Sinai is the highest (Ex. 17:6); now called the Serbal range.” (BBC)
The Lord stood before Moses on the rock at Horeb and Moses struck the rock with the staff and water came out of it. The people wanted to stone moses but it was the Lord who stood on the rock that Moses struck and water came poring out.
Jesus was taken to the place of the skull, (Jn. 19:17) there they crucified him. (Jn. 19:18) One of the soldiers stuck his side with a spear, and immediately blood and water came out. (Jn. 19:34)
Moses named the place test and quarrel because the sons of Israel quarreled with him and they tested the Lord. So, instead of Moses being stoned, it was the Lord. Moses struck at the place where the Lord stood before him and water came out of the stone.
Rephidim was the location of Israel’s first battle with the inhabitants of Canaan. Amalek was a descendant of Esau through Esau’s son Eliphaz and a concubine named Timna. (Gn 36:12) Amalek attacked the sons of Israel and the sons of Israel defeated Amalek. When Moses held up the staff of God in his hand, the sons of Israel prevailed but when he let down the staff, Amalek prevailed; therefore, Aaron and Hur supported Moses. Joshua was commander of the Israelite army. The Lord told Moses to write down in a book this prophecy and recite it to Joshua. “I will utterly blot out the memory of Amalek from under heaven.” (Ex. 17:14) We only know about Amalek because his name is written in Scripture but his people are no more.