The Messenger of Allah ﷺ set out from Medina toward Mecca and fasted until he reached Usfan. Then he called for water, raised it up in his hand to show the people, and broke his fast. He continued without fasting until he arrived in Mecca, and this took place during Ramadan.Ibn Abbas used to say, "The Messenger of Allah ﷺ both fasted and broke his fast, so whoever wishes may fast, and whoever wishes may break his fast."
حدثنا عفان حدثنا أبو عوانة عن منصور عن مجاهد عن طاوس
خرج رسول الله ﷺ من المدينة إلى مكة فصام حتى بلغ عسفان ثم دعا بماء فرفعه إلى يده ليريه الناس فأفطر حتى قدم مكة وذلك في رمضان وكان ابن عباس يقول قد صام رسول الله ﷺ وأفطر فمن شاء صام ومن شاء أفطر
Its isnad is sahih. Abu Dawud (2:290) narrated it from Musaddad from Abu Awana. Munziri said, Bukhari, Muslim, and Nasai also related it, and it will come again at 2996. See also 2057, 2392, 3089.