Consider a function $f$ defined over a $n$-dimensional manifold $\mathcal{M}$ and assume $f$ is the restriction of a function $g$ defined over a vector space of dimension $n+1$.
Example: $$f:\mathcal{S}^2\ni u\mapsto \dfrac{u}{\|u\|}\quad \text{and}\quad g:\mathbb{R}^3\ni v\mapsto \dfrac{v}{\|v\|}.$$
Question: Under what conditions do the covariant derivatives of $f$ and $g$ coincide on $\mathcal{M}$? In other words, is the derivative of the restriction equal to the restriction of the derivative?
Yes: to see this, use the chain rule and the usual identification $T_pM\simeq di_p(T_pM)\subset\mathbb{R}^{n+1}$, where $i:M\to \mathbb{R}^{n+1}$ is the inclusion. Namely, you have by definition that $f|_M=f\circ i$, and
$$d(f|_M)_p=d(f\circ i)_p=df_{i(p)}\circ di_p=df_p\circ di_p$$
leads to $d(f|_M)_p=df_p|_{T_pM}$.