Let $ f:A\to B$ be an injective, local homorphism between two Noetherian local rings. Consider the completions $\hat A$ and $\hat B$ with respect the maximal ideals. We have an induced homomorphism $\hat f: \hat A \to\hat B$. What assumptions do we need in order to ensure that also $\hat f$ is injective?

My main interest is geometric, so for example the local map induced by a surjective morphism between Noetherian schemes.

Many thanks in advance