The Hebrews traveled slowly across Sin, making camp wherever God told them to. When they were camped at Rephidim, they ran out of water and began cursing and attacking Moses again. Moses was all, help God! I think they’re really gonna kill me this time! God was all, you still have that magic staff don’t you? Well gather all the people, and then take the magic staff and hit the rock of Horeb and voila, water.
So Moses did, and then renamed the place Massah. Or was it Meribah?
Around this time, the people of Amalek felt threatened by the horde of homeless Hebrews heading their way, so they sent out a war party. Moses told Joshua to gather all the fighting men and engage them in battle. So Joshua led the army out against the Amalekites while Moses, Aaron and Hur watched from the top of a nearby hill. As long as Moses held the magic staff aloft, the Hebrews kept winning, but after awhile he got really tired. So Aaron and Hur found him a rock to sit on and then they got on either side of Moses and held up his arms. They stayed like this until the sun started going down, at which time the armies called it a day, and the victory went to the Hebrews.
God told Moses to write down all the events for posterity because It had some genocide planned for the Amalekites.