Let $f:X\to Y$ be a flat morphism between two Noetherian, integral, regular schemes. Let $D\in \operatorname{Div}(Y)$ any (Weil or Cartier) divisor, in this setting it has sense to consider the pullback $\,f^\ast D\in\operatorname{Div }(X)$.
Define the ramification index of $f$ at $x$ as: $$e_x:=\operatorname{length}_{\mathcal O_{X,x}}\frac{\mathcal O_{X,x}}{\mathfrak m_{f(x)}\mathcal O_{X,x}}$$
I'd like to show that the following formula is true:
$$f^\ast D=\sum_{x\in\star} e_x\operatorname{mult}_{f(x)}(D)\overline{\{x\}}$$ where $\star$ is the set of points $x\in X$ of codimension $1$ such that also $f(x)$ has codimension $1$. This formula is very important indeed it gives an explicit way to calculate the pullback of a divisor.
Can you give an hint for the proof or give any references? For instance the Stack project reference given here is wrong (probably the document has been updated).
Many thanks in advance.