When Moshe Rabbeinu realized that all of his pleas failed, and he would not be entering Eretz Yisrael, he was concerned who his successor would be. Moshe tells Hashem that he doesn’t want the עם to be like sheep without a shepherd.
Rabbi Soloveitchik points out how remarkable Hashem’s great mercy has been over the generations. Somehow when a great leader passed away, there was always someone available to take his place.
In the case of Yehoshua, he was a fulfillment of the Pasuk in Mishlei that says, “He who guards the fig tree, eats the fruit.” The key word regarding Yehoshua was “loyalty.” He proved to be Moshe’s closest confidant. He may not have been as great a scholar as Pinchas or Elazar, but he was definitely the most loyal.
Yehoshua was rewarded for his loyalty by being chosen to succeed Moshe. We must show equal loyalty to Hashem and to all those who consistently are there for us. Shabbat Shalom