Narrated Abdullah ibn Amr ibn al-'As: The Prophet ﷺ said: The similitude of the one who takes back what he gifted is like that of a dog which vomits and then it eats vomit. When a donor seeks to take back (his gift), it should be made known and he informed why he sought to take it back. Then whatever he donated should be returned to him.
The Prophet Muhammad was teaching us about being generous with our time, money or resources without expecting anything in return; this can be seen as an act of worship in itself as we are pleasing Allah by helping others in need. We should also remember that if someone does seek to take back what they have given away for whatever reason, we must respect their wishes but also remind them of the importance of giving generously without expecting anything in return.