Here in his copying from 𝓞 into 𝓟, Oliver Cowdery initially wrote “God gave commandments”; then virtually immediately Oliver supralinearly inserted the indirect object pronoun him (there is no change in the level of ink flow). Most probably, 𝓞 read that way. The indirect object, him, is not required here, as we can see from the following example: “for he gave commandment that all men must repent” (2 Nephi 2:21). There would have been little, if any, motivation for Oliver to emend the text here in Alma 22:12.
Summary: Accept in Alma 22:12 Oliver Cowdery’s corrected reading in 𝓟: “and that God gave him commandments”.