(This comes from the proof of the Gauss-Bonnet Theorem for surfaces with boundary. See Do Carmo's 'Differential Forms and Applications' Chapter 6, Theorem 2.)
Let $M$ be an oriented, compact, two-dimensional differentiable manifold with boundary $\partial M$.
Let $X$ be a differentiable vector field on $M$ such that it is transversal to $\partial M$. Now choose a metric on $M$ and consider in $M$ the orthonormal oriented moving frame $\bar{e}_1=X/|X|,\; \bar{e}_2$.
Choose in a neighborhood $V\subset M$ of $\partial M$ another oriented moving frame $e_1,e_2$ such that restricted to $\partial M$, $e_1$ is tangent to $\partial M$. Then
$$ i^*\bar{\omega}_{12}=i^*\omega_{12}+d\phi $$ where $i:\partial M\to M$ is the inclusion map, and $\phi$ is the angle between $\bar{e}_1$ and $e_1$ along $\partial M$.
Then in the proof of the Gauss-Bonnet Theorem for surfaces with boundary. A key step states that:
Since $\bar{e}_1=X/|X|$ is nowhere tangent to $\partial M$, $\int_{\partial M}d\phi=0$.
This statement confuses me.
My main question is, how to prove this statement?
My initial thought is, by Stokes Theorem, it seems that $\int_{\partial M}d\phi=\int_{M} d^2\phi=0$ is always true, soon I realized that $d\phi$ is not a 1-form defined in $M$.
So my second question is, if there are two moving frames $\{e_1,e_2\}$ and $\{\bar{e}_1,\bar{e}_2\}$ satisfying:
$$ \bar{e}_1=fe_1+ge_2\\ \bar{e}_2=-ge_1+fe_2 $$
with $f,g$ being differentiable functions, and $f^2+g^2=1$, then the connection forms satisfy:
$$ \omega_{12}=\bar{\omega}_{12}-\tau $$
where $\tau$ is the differential of the "angle function" between $e_1$ and $\bar{e}_1$ along a curve.
My question is, is the 1-form $\tau$ exact?
Again, I think the answer should be no. For instance, the differential of the "angle function" in $R^2$ is closed but not exact, since it is defined in $R^2-\{0\}$, but I still struggle to prove this in a more general 2-d manifold.
It is a long post, thank you for reading, and any hints are appreciated!