We did not pledge allegiance to the Messenger of Allah ﷺ on death. Rather, we pledged to him that we would not flee.
أخبرنا قتيبة قال حدثنا سفيان عن أبي الزبير سمع
لم نبايع رسول الله ﷺ على الموت إنما بايعناه على أن لا نفر
Graded by Muslim, Chapter on the Book of Leadership, Chapter on the recommendation of the army pledging allegiance to the leader when intending to fight, etc., Hadith: 68/1856, from the hadith of Sufyan bin Uyayna, with the same chain, and it is found in Kubra, Hadith: 7779.