14 Then the Lord said to Moses, "Behold, the days approach when you must die; call Joshua, and present yourselves in the tabernacle of meeting, that I may inaugurate him." So Moses and Joshua went and presented themselves in the tabernacle of meeting. 15 Now the Lord appeared at the tabernacle in a pillar of cloud, and the pillar of cloud stood above the door of the tabernacle. 16 And the Lord said to Moses: "Behold, you will rest with your fathers; and this people will rise and play the harlot with the gods of the foreigners of the land, where they go to be among them, and they will forsake Me and break My covenant which I have made with them. 17 Then My anger shall be aroused against them in that day, and I will forsake them, and I will hide My face from them, and they shall be devoured. And many evils and troubles shall befall them, so that they will say in that day, 'Have not these evils come upon us because our God is not among us?' 18 And I will surely hide My face in that day because of all the evil which they have done, in that they have turned to other gods. 19 Now therefore, write down this song for yourselves, and teach it to the children of Israel; put it in their mouths, that this song may be a witness for Me against the children of Israel. 20 When I have brought them to the land flowing with milk and honey, of which I swore to their fathers, and they have eaten and filled themselves and grown fat, then they will turn to other gods and serve them; and they will provoke Me and break My covenant. 21 Then it shall be, when many evils and troubles have come upon them, that this song will testify against them as a witness; for it will not be forgotten in the mouths of their descendants, for I know the inclination of their behavior today, even before I have brought them to the land of which I swore to give them."

22 Therefore Moses wrote this song the same day, and taught it to the children of Israel.

Matthew Henry's Commentary on Deuteronomy 31:14-22

Commentary on Deuteronomy 31:14-22

(Read Deuteronomy 31:14-22)

Moses and Joshua attended the Divine Majesty at the door of the tabernacle. Moses is told again that he must shortly die; even those who are most ready and willing to die, need to be often reminded of its coming. The Lord tells Moses, that, after his death, the covenant he had taken so much pains to make between Israel and their God, would certainly be broken. Israel would forsake Him; then God would forsake Israel. Justly does he cast those off who so unjustly cast him off. Moses is directed to deliver them a song, which should remain a standing testimony for God, as faithful to them in giving them warning, and against them, as persons false to themselves in not taking the warning. The word of God is a discerner of the thoughts and intents of men's hearts, and meets them by reproofs and correction. Ministers who preach the word, know not the imaginations of men; but God, whose word it is, knows perfectly.