And know that the Levush wrote: One provides food to a dog that he raises in his house, see there; it is explicitly clear that if the dog is not his, one should not place food before it. And there is one who wrote that from the Gemara it is implied that even if the dog is not his, it is a mitzvah to give to it, and his intention is from what they said at the end of Shabbat: "A righteous man knows the judgment of the poor," which refers to a dog, and it says there that it is the way of the world to throw a piece of raw meat to a dog, see there (Magen Avraham, subsection 7). And there are those who rejected this, for behold it says there that this is in the field, but in the city it will come to follow him (Tosefot Shabbat and Machatzit HaShekel, see there). And I say that it is also implied as such from the Tur, from what he wrote: "One places before a dog but not before a pig," and a pig certainly cannot be his, for it is forbidden to raise pigs. And it is a forced explanation to say when he inherited it; rather, it is certainly similar to this regarding a dog, that one gives even if it is not his. And there is also proof from Rashi in the first chapter (19a): "One places food before the dog in the courtyard and one places food before etc.," and Rashi explained: "A dog, it is incumbent upon him to feed it," see there, and he did not write: "A dog that is incumbent upon him," implying that every dog is incumbent upon him because it lacks food. And that which they said "not in the city," that is specifically not to habituate it constantly, but occasionally it is fine, and "His mercies are over all His works" is written, and from the Baraita itself it is implied as such to one who is precise there. (And see Tosefot there who wrote: Since we support their poor for the sake of the ways of peace, it is considered somewhat that their food is upon you, see there, and all the more so the dog when it is hungry. And in my humble opinion, any living creature that I know is hungry - it is a mitzvah to give to it even on Shabbat, for "His mercies are over all His works" is written, and see what the Ran wrote there in the name of the Ra'avad, and delve into this.)
ודע דהלבוש כתב: נותנין מזונות לכלב שמגדלו בביתו ע"ש, מבואר להדיא דאם אין הכלב שלו אין ליתן לפניו מזונות. ויש מי שכתב דבגמרא משמע דאפילו אין הכלב שלו מצוה ליתן לו, וכונתו ממה שאמרו שלהי שבת: יודע צדיק דין דלים דקאי אכלב, ואומר שם דאורח ארעא למישדא אומצא לכלבא ע"ש (מג"א סק"ז). ויש שדחו זה, שהרי אומר שם דזהו בדברא, אבל במתא אתי למיסרך (ת"ש ומחה"ש ע"ש). ואני אומר דגם מהטור משמע כן, מדכתב: 'נותנין לפני כלב ולא לפני חזיר', וחזיר ודאי אי אפשר להיות שלו, דהא אסור לגדל חזירים. ודוחק לומר כשירש, אלא ודאי דדומיא דהכי בכלב, דנותנין אפילו אינו שלו, וגם ראיה מרש"י בפרק קמא (י"ט.): 'נותנין מזונות לפני הכלב בחצר ונותנין מזונות לפני וכו', ופירש רש"י: 'כלב רמי עליה לזונו' ע"ש, ולא כתב: 'כלב דרמי עליה', משמע שכל כלב רמי עליה מפני שהוא מחוסר מזונות. וזה שאמרו במתא לא, היינו שלא להרגילו בתמידיות, אבל באקראי שפיר דמי, ורחמיו על כל מעשיו כתיב, ומהברייתא עצמה משמע כן למדקדק שם. (ועיין תוספות שם שכתבו: כיון דמפרנסים ענייהם מפני דרכי שלום, חשיב קצת מזונותן עליך ע"ש, וכל שכן הכלב כשהוא רעב. ולעניות דעתי כל בעל חי שאני יודע שהוא רעב - מצוה ליתן לו גם בשבת, דורחמיו על כל מעשיו כתיב, ועיין מ"ש שם הר"ן בשם הראב"ד ודו"ק).