Let us suppose $L$ is base-point-free first. Let $\phi_1:C\to C'$ be the restricted morphism. Now $\phi$ is a finite morphism of curves. By construction,
$$
L=\phi^\ast(\mathscr O(1))=\phi_1^\ast \mathscr O(1)|_{C'}\,\Rightarrow\,\deg L=(\deg\phi_1)(\deg C')=(\deg\phi)(\deg C').
$$
The base locus of $\phi$ can be viewed as the effective divisor $B=\sum_{P\in C}n_P[P]$ where all sections in $H^0(C,L)$ vanish. The degree $\deg L$ is the number of zeros minus the number of poles of any rational section of $L$. But the rational map $\phi:C\dashrightarrow \mathbb P(|L|)^\vee$ is undefined exactly at the points $P$ in the support of $B$. So any such point has to contribute to $\deg L$ (necessarily by $n_P$).
Added. More on $\deg \phi_1^\ast \mathscr O(1)|_{C'}=(\deg\phi_1)(\deg C').$
For a finite morphism of curves $f:C\to C'$ and for any divisor $D\subset C'$, we have $f_\ast[f^\ast D]=(\deg f)[D]$, as cycles on $C'$. In particular, we have $\deg f_\ast[f^\ast D]=(\deg f)(\deg D)$. Let me be more precise:
$$
\deg f^\ast[D]:=\int_Cf^\ast[D]=\int_{C'}f_\ast[f^\ast D]=\int_{C'}(\deg f)[D]=(\deg f)\int_{C'}[D]=:(\deg f)(\deg D).
$$
For us, $D=\mathscr O(1)|_{C'}$, which has degree $\deg C'$ (I use, here, the definition of degree as the number of points in the intersection $C'\cap H$ with a general hyperplane: it seems more natural in this context, as $\mathscr O(1)$ corresponds to a hyperplane, and $\mathscr O(1)|_{C'}$ corresponds to intersecting $C'$ with a hyperplane).
Added.
Apart from the equality $f_\ast[f^\ast D]=(\deg f)[D]$, the only nontrivial issue in the displayed equations is the second equality. There, we use functoriality of degree. The degree of a cycle on a (proper) variety $Y$ can be defined (Fulton, Intersection Theory) as the operator
$$\deg_Y(\cdot)=\int_Y\cdot=p_\ast(\cdot)\,\,\,\,\,\,\,\,\,\textrm{(these are synonyms!)}$$
Functoriality then says that if we have a morphism $f:X\to Y$ (with $X$ proper) then for a cycle $\alpha$ on $X$ we have $\deg_X(\alpha)=\deg_Y(f_\ast\alpha)$.