Ali arrived from Yemen, and the Prophet ﷺ asked him, "With what did you enter ihram?"He replied, "With the same intention as the Prophet ﷺ."The Prophet ﷺ said, "Had I not brought the sacrificial animal with me, I would have exited ihram."
قدم علي رضي الله عنه من اليمن فقال له النبي ﷺ: بم أهللت؟ قال: بما أهل به النبي ﷺ قال: لولا أن معي الهدي لأحللت.
Bukhari related it in Hajj (1558), and Muslim in Hajj (1250), both through Abdul-Samad, who said, Salim bin Hayan told us, he said, I heard Marwan al-Asfar, from Anas bin Malik, who related it. Their wordings are the same.