Solution (source code)

= Solution

A covariant derivative is an $\mathbb R$-linear map
$$
d_A:\Gamma(E)\to\Omega^1(B;E)
$$
satisfying $d_A(fs)=df\otimes s+f\,d_As$. It is local: its value over an open set depends only on the restriction of the section there. A horizontal connection differentiates a section, projects its derivative vertically, and identifies the vertical tangent with the fibre.

In a local frame write $d_As=ds+A_is\,dy^i$. If $x^a$ are coordinates on $M$, the defining identity in the question forces
$$
d_{A'}(s\circ f)=d(s\circ f)+A'_a(s\circ f)\,dx^a
$$
with
$$
\boxed{A'_a(x)=A_i(f(x))\frac{\partial f^i}{\partial x^a}(x).}
$$
Thus $A'=f^*A$, the <pullback connection>.