The Messenger of Allah ﷺ said, "If the Final Hour arrives while one of you has a sapling in his hand, let him plant it."
حدثنا وكيع حدثنا حماد بن سلمة عن هشام
قال رسول الله ﷺ إن قامت على أحدكم القيامة وفي يده فسلة فليغرسها
Its isnad is sahih. Hisham is Ibn Zayd bin Anas, the grandson of Anas. The hadith appears in Tayalisi's Musnad, p. 275, no. 2068, from Hammad, from him, with the same wording. Bukhari has something similar in Adab al-Mufrad, 168, no. 479.