The whole community of Israelites left the desert of Sin, travelling by stages as Yahweh ordered. They pitched camp at Rephidim where there was no water for the people to drink.
The people took issue with Moses for this and said, 'Give us water to drink.' Moses replied, 'Why take issue with me? Why do you put Yahweh to the test?'
But tormented by thirst, the people complained to Moses. 'Why did you bring us out of Egypt,' they said, 'only to make us, our children and our livestock, die of thirst?'
Moses appealed to Yahweh for help. 'How am I to deal with this people?' he said. 'Any moment now they will stone me!'
Yahweh then said to Moses, 'Go on ahead of the people, taking some of the elders of Israel with you; in your hand take the staff with which you struck the River, and go.
I shall be waiting for you there on the rock (at Horeb). Strike the rock, and water will come out for the people to drink.' This was what Moses did, with the elders of Israel looking on.
He gave the place the names Massah and Meribah because of the Israelites' contentiousness and because they put Yahweh to the test by saying, 'Is Yahweh with us, or not?'
The Amalekites then came and attacked Israel at Rephidim.
Moses said to Joshua, 'Pick some men and tomorrow morning go out and engage Amalek. I, for my part, shall take my stand on the hilltop with the staff of God in my hand.'
Joshua did as Moses had told him and went out to engage Amalek, while Moses, Aaron and Hur went up to the top of the hill.
As long as Moses kept his arms raised, Israel had the advantage; when he let his arms fall, the advantage went to Amalek.
But Moses' arms grew heavy, so they took a stone and put it under him and on this he sat, with Aaron and Hur supporting his arms on each side. Thus his arms remained unwavering till sunset,
and Joshua defeated Amalek, putting their people to the sword.
Yahweh then said to Moses, 'Write this down in a book to commemorate it, and repeat it over to Joshua, for I shall blot out all memory of Amalek under heaven.'
Moses then built an altar and named it Yahweh-Nissi
meaning, 'Lay hold of Yahweh's banner! Yahweh will be at war with Amalek generation after generation.'